How to query a posts from a specific author by the user id?

Hi everyone!

I created a CPT called “Team Members”. Some of that team members are also authors of blog posts. So I added a an ACF user field called “Team Member User ID”.

On the “Team Members” single page template I tried to setup the query but couldn’t manage to get the correct posts displayed.

What I tried was to set up a query for posts and query the user with the meta query:

Query:

  • Typ: Posts
  • Posttype: Post

Meta Query:

  • Meta Key: author (also tried author__in)
  • Meta Value: {Team Member User ID} (the correct user id is returned)
  • Compare: equal
  • Type: numeric (also tried char)

I already spent hours of googling the internet but couldn’t find a working solution for that and couldn’t get it to work. Any tipps for me?

Thank you very much. Every hint is very much appreciated.

All the best,
Max

2 Likes

I need this option too, in a similar way, to only show posts created by a user/author for a frontend dashboard

Does this help? Displaying current user posts with Query Loop - BricksUltimate

or try this one which has worked for me: Show only posts of logged in author when using Bricks Builder - YouTube

Any luck solving this?

I hope I get your requirement correct… You want to show posts from specific users, correct?
Why you don’t use simply users for that? Posttyp whateveryou need and filtered by “author”?