Making WordPress.org


Ignore:
Timestamp:
10/25/2019 03:02:29 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Author Card: Only query for plugins if there are plugins. Avoids a 'bad looking' query with an empty IN()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php

    r9096 r9237  
    9797        }
    9898        $author_plugins = get_posts( $author_plugins_q );
    99         $all_plugins    = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} WHERE post_name IN ('" . implode( "', '", array_merge( $author_commit, wp_list_pluck( $author_plugins, 'post_name' ) ) ) . "')" );
     99        $all_plugins    = array();
     100        if ( $author_plugins || $author_commit ) {
     101            $all_plugins = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} WHERE post_name IN ('" . implode( "', '", array_merge( $author_commit, wp_list_pluck( $author_plugins, 'post_name' ) ) ) . "')" );
     102        }
    100103        ?>
    101104        <div class="profile">
Note: See TracChangeset for help on using the changeset viewer.