How to display particular categorie's post which associated to specific user?


Above link displays all the posts under fish category, but how can I display only the posts which are under fish category and particular user also.

Is there any URL like above which displays user specific posts? It can be with User ID.

1 Answer 1


How are you associating users to a post? If you meant users as post authors you can try pre_get_posts hook.

function user_author_pre_get_posts( $query ) {
    $user_id = get_current_user_id(); // Get logged in user ID or pass specific user ID here
  if ( ( $query->is_author() || $query->is_category() ) && $query->is_main_query() ) {
        $query->set( 'author__in', $user_id );
add_action( 'pre_get_posts', 'user_author_pre_get_posts' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.