Skip to content
Public Ticket #30818

how to remove posts below admin name

Conversation thread

PenciDesign Supporter replied

Staff Reply

Hi,

You should paste this code into the function.php of the child theme or via the CodeSnippet plugin here: https://wordpress.org/plugins/code-snippets/

function penci_user_remove_author_posts( $query ) {
    if ( ! is_admin() && $query->is_main_query() && $query->is_author() ) {
        $query->set( 'post__in', array(0) ); // Prevents any posts from being displayed
    }
}
add_action( 'pre_get_posts', 'penci_user_remove_author_posts' );

Regards,
PenciDesign.

satyanandi191 started the conversation

Conversation Start

i want to delete post shown below admin name, it looks odd. when i click in author name, it gives author details but shows posts details which looks so odd. i attach two snap shots.

Want to join this conversation or access attachments? Sign in first.