I've tested your code on my test website and it works as expected, even with the String Translation plugin activated.
Looks like something specific to your website is involved. The website is still not accessible, so I'll wait to hear back from you, once the website is back online.
I'll also need your permission to download a clone/snapshot of the website to test it on a different server, in case it's needed.
During testing on your website's clone, I was able to make this REST API endpoint work with the String Translation active, by changing the line in the 'get_author_posts' function from:
Hi Waqar, that seems to fix the query thanks. Can you tell me what is interfiring with that method though? That could be the cause of the other issue I talk about, when I want to filter by author posts in the WordPress dashboard the query shows an empty page.
Since I can't reproduce this behavior on a clean test website, it has to do with some user role and capability changes added to your website by a third-party theme or plugin.
The main difference between the 'author' and 'author__in' parameters is that the first one works for a single user ID and the second one checks from multiple (array) user IDs.
WordPress doesn't out-of-the-box support multiple user role assignments, but membership and user roles and capabilities management plugins can include it. That is the only logical explanation I can't think of.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.