Making WordPress.org


Ignore:
Timestamp:
09/29/2020 05:59:41 AM (5 years ago)
Author:
dd32
Message:

Theme Directory: Upload: Handle invalid/missing theme meta more gracefully.

This avoids a PHP Notice when the status of the current version of the theme is unknown, which seems it can happen for new not-yet-approved themes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r10243 r10311  
    393393 */
    394394function wporg_themes_update_version_status( $post_id, $current_version, $new_status ) {
    395     $meta = get_post_meta( $post_id, '_status', true );
    396 
    397     if ( empty( $meta ) ) {
    398         $meta = array();
    399         $old_status = false;
    400     } else {
     395    $meta = get_post_meta( $post_id, '_status', true ) ?: array();
     396
     397    $old_status = false;
     398    if ( isset( $meta[ $current_version ] ) ) {
    401399        $old_status = $meta[ $current_version ];
    402400    }
Note: See TracChangeset for help on using the changeset viewer.