[wp-trac] [WordPress Trac] #54921: wp_dropdown_users_args Filter not working in WordPress 5.9

WordPress Trac noreply at wordpress.org
Wed Jan 26 13:02:33 UTC 2022


#54921: wp_dropdown_users_args Filter not working in WordPress 5.9
--------------------------+-------------------------------
 Reporter:  martin7ba     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  5.9
 Severity:  major         |   Keywords:  reporter-feedback
  Focuses:                |
--------------------------+-------------------------------
 I have the following code that works great on WP 5.8.3, but it is not
 working on WP 5.9.

 I had to rollback to WP 5.8.3.

 It is just showing the administartor role users, but not the custom role
 'company_owner'. In version 5.8.3 works great.

 {{{#!php
 <?php
 add_filter( 'wp_dropdown_users_args', 'display_additional_author_roles',
 99, 2 );

 function display_additional_author_roles( $query_args, $parsed_args ) {
                 if ( 'company' !== get_post_type() ) {
                         return $query_args;
                 }

                 if ( isset( $parsed_args['name'] ) &&
 'post_author_override' === $parsed_args['name'] ) {
                         if ( isset( $query_args['who'] ) ) {
                                 unset( $query_args['who'] );
                         }

                         $query_args['role__in'] = array( 'administrator',
 'company_owner' );
                 }

                 return $query_args;
         }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54921>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list