cabrerahector / wordpress-popular-posts

WordPress Popular Posts - A highly customizable WordPress widget that displays your most popular posts.
https://wordpress.org/plugins/wordpress-popular-posts/
GNU General Public License v2.0
279 stars 83 forks source link

Getting a 404 when a author ID or any integer is entered for the REST API #265

Closed bmarshall511 closed 4 years ago

bmarshall511 commented 4 years ago

When trying to use the REST API, I want to grab posts by author. But get a 404 everytime, examples:

But using a string like:

it resolves, though of course isn't pulling by author.

Using the latest WP & plugin versions.

cabrerahector commented 4 years ago

Hi Ben,

Just checked on my website and I can't reproduce this. The endpoint works normally for me: https://cabrerahector.com/wp-json/wordpress-popular-posts/v1/popular-posts?author=1,3&range=all

Maybe another plugin or something in your .htaccess rules is causing this?

bmarshall511 commented 4 years ago

Maybe, but don't think so. I've tried several other arguments & all seem to be working fine. Just doesn't like the author argument.

Here's the site:

404: https://benmarshall.me/wp-json/wordpress-popular-posts/v1/popular-posts?author=1 Working: https://benmarshall.me/wp-json/wordpress-popular-posts/v1/popular-posts?post_type=post&limit=3&order_by=views&range=last30days 404 (same as the working, but with the author attribute): https://benmarshall.me/wp-json/wordpress-popular-posts/v1/popular-posts?post_type=post&limit=3&order_by=views&range=last30days&author=1

cabrerahector commented 4 years ago

Unfortunately links won't tell me much, Ben. As stated earlier, the endpoint works for me so it seems evident that the issue is on your side.

You'll need to do some debugging (disable plugins, switch to a different theme, check your .htaccess rules, try your setup on a different server (like a staging site, local server, etc.)) to figure out what's going on.