All Topics
Error when want to show only register user posts
Hi, when I try to do this function, to show only current user posts, the action do the job, but not show ACF fields, it show a “-” instead . You can see the image below.
add_action('pre_get_posts', 'query_set_only_author' );
function query_set_only_author( $query ) {
global $current_user, $pagenow;
if( 'edit.php' == $pagenow){
$query->set( 'author', $current_user->ID );
}
}
Is there another way to show only current user posts?
Thanks
You must be logged in to reply to this topic.