Making WordPress.org


Ignore:
Timestamp:
10/07/2016 04:44:39 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: Switch Contributors from being stored as post meta to a taxonomy to allow for more efficient querying.

/author/$author/ / author_name queries are now based on this taxonomy rather than by the post_author.

See #1724, #1840.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php

    r3888 r4197  
    6868        $result['contributors'] = array();
    6969
    70         $contributors = get_post_meta( $post_id, 'contributors', true ) ?: array( $post->user_login );
     70        if ( $contributors = get_the_terms( $post->ID, 'plugin_contributors' ) ) {
     71            $contributors = wp_list_pluck( $contributors, 'slug' );
     72        } else {
     73            $contributors = array();
     74            if ( $author = get_user_by( 'id', $post->post_author ) ) {
     75                $contributors[] = $author->user_nicename;
     76            }
     77        }
    7178        foreach ( $contributors as $contributor ) {
    7279            $user = get_user_by( 'slug', $contributor );
Note: See TracChangeset for help on using the changeset viewer.