• Hi all, has anyone else seen any issues with being able to select the stock “author” role within a post? My users are only able to select from users who have a custom role. Edit – forgot to mention this is only when using the “quick edit” option or editing in classic editor.

    • This topic was modified 2 years, 10 months ago by luketub.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter luketub

    (@luketub)

    Looks like its something to do with edit_posts permission, authors currently don’t have that permission. If I create a new role, then add edit_posts permission, people with that role are able to be selected as author.

    Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    This is expected behavior starting from WordPress version 5.9.
    Earlier versions extracted users who can be author via ‘get_users()’ function using ‘who=>authors’ argument. Finally user level not equal 0 was checked (more details).

    WordPress 5.9 declared ‘who’ argument as deprecated

    if ( isset( $qv['who'] ) && 'authors' === $qv['who'] && $blog_id ) {
    			_deprecated_argument(
    				'WP_User_Query',
    				'5.9.0',
    				sprintf(
    					/* translators: 1: who, 2: capability */
    					__( '%1$s is deprecated. Use %2$s instead.' ),
    					'<code>who</code>',
    					'<code>capability</code>'
    				)
    			);

    and proposed to use ‘capability’ argument, like it does itself building authors dropdown list:

    function post_author_meta_box( $post ) {
    	global $user_ID;
    
    	$post_type_object = get_post_type_object( $post->post_type );
    	?>
    <label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
    	<?php
    	wp_dropdown_users(
    		array(
    			'capability'       => array( $post_type_object->cap->edit_posts ),
    			'name'             => 'post_author_override',
    			'selected'         => empty( $post->ID ) ? $user_ID : $post->post_author,
    			'include_selected' => true,
    			'show'             => 'display_name_with_login',
    		)
    	);
    }

    Thanks for the update, @shinephp! Is this something that will be added to the next URE release?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No longer able to see author role’ is closed to new replies.