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'] = __( '— 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?
1 Answer
Reset to default 1An 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.
}