How to remove the dropdown author data from the post edit page

admin2025-06-04  4

When there are thousands of users registered in a website, the edit.php page will have performance issues.

if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
            $users_opt = array(
                'hide_if_only_one_author' => false,
                'who' => 'authors',
                'name' => 'post_author',
                'class'=> 'authors',
                'multi' => 1,
                'echo' => 0,
                'show' => 'display_name_with_login',
            );
            if ( $bulk )
                $users_opt['show_option_none'] = __( '— No Change —' );

            if ( $authors = wp_dropdown_users( $users_opt ) ) :
                $authors_dropdown  = '<label class="inline-edit-author">';
                $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
                $authors_dropdown .= $authors;
                $authors_dropdown .= '</label>';
            endif;
        endif; // authors

How can I remove the author list in the post edit page via functions.php file?

When there are thousands of users registered in a website, the edit.php page will have performance issues.

if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
            $users_opt = array(
                'hide_if_only_one_author' => false,
                'who' => 'authors',
                'name' => 'post_author',
                'class'=> 'authors',
                'multi' => 1,
                'echo' => 0,
                'show' => 'display_name_with_login',
            );
            if ( $bulk )
                $users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );

            if ( $authors = wp_dropdown_users( $users_opt ) ) :
                $authors_dropdown  = '<label class="inline-edit-author">';
                $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
                $authors_dropdown .= $authors;
                $authors_dropdown .= '</label>';
            endif;
        endif; // authors

How can I remove the author list in the post edit page via functions.php file?

Share Improve this question edited Jan 22, 2017 at 20:45 Johansson 15.4k11 gold badges44 silver badges80 bronze badges asked Jan 22, 2017 at 19:43 user111527user111527 133 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

An easy sulotion will be to remove the post type author feature.

add_action( 'init', 'remove_cpt_author' );
function remove_cpt_author() {
    remove_post_type_support('post', 'author'); // this function require the post type and the feature you want to remove.
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748974412a315297.html

最新回复(0)