2

Is there a standard route for getting all blog posts by specific author id? I can't find anything obvious. I tried this but I get a 404 error

http://localhost:8888/mysite/wp-json/wp/v2/posts?author=125
5
  • Is it a vanilla setup? Permalinks on? Can you access other rest endpoints? Seems to work for public WP sites I tested on.
    – birgire
    Feb 19, 2021 at 11:51
  • That URL looks correct to me too. Even if the author argument was incorrect, you should get a response with the all posts, not a 404. What are your permalink settings? Feb 19, 2021 at 12:22
  • I can access all the other normal endpoints like posts, pages etc. and I can apply other arguments which work too like eg: author_exclude . Permalinks are set to 'Post name'. Feb 22, 2021 at 5:18
  • 1
    So, I just deactivated all plugins and it works. I then activated one by one to find the culprit and it is WordFence. As soon as I activate that I get the 404 error again. I am not sure why this is but it is the plugin responsible. Feb 22, 2021 at 5:48
  • 1
    Seems like WordFence disables this route to prevent username fishing. There is an option to disable it and the author route works again Feb 22, 2021 at 5:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.