Get more than 10 posts in a specific category with the wordpress api

I’m currently building an Ionic app that uses the WordPress api. I can retrieve posts in a specific category by using the following:

// Retrieve filtered data for the categories to show posts.
    function getCategoryName(categoryName) {
        return ($http.get(svampeURL + 'posts?categories=" + categoryName).then(handleSuccess, handleError));
    }

The problem is that it only returns 10 as it is some sort of default. I have tried using the per_page=50 argument but it doesn”t seem to work. I have also read the documentation of the api and it seems like they don’t describe this scenario.

Is there any way to get more than 10 posts in a specific category? How do I change this default return?

1 Answer
1

See if your url is correct. Example: website.com/wp-json/wp/v2/posts/?categories=3&per_page=‌​50

Leave a Comment