$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>How to remove the dropdown author data from the post edit page|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin10PV0评论

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.
}
Post a comment

comment list (0)

  1. No comments so far