Select Page

Increasing wordpress per_page maximum (Fixes Invalid parameter(s): per_page)

Have you run into the issue where WordPress won’t return the number of results you’re seeking through the API? The api accepts a per_page parameter, however WordPress has this value capped at 100. That’s a pretty low maximum and unfortunately they’ve made it difficult to change it. I found various suggestions to use this filter, or that filter, but none worked because they are applied after the per_page maximum check runs. I had to dig deep to find a filter which runs at the right time.

This code increases the per_page maximum for the endpoint /wc/v3/products to 512, but it should be easy to modify for other endpoints and values.

Hopefully I can save you the effort, here’s the code:

add_filter( 'rest_endpoints', 'increase_rest_endpoint_per_page_maximum', 10, 1 );
function increase_rest_endpoint_per_page_maximum( $endpoints ) {
    foreach($endpoints as $endpoint => $methods){
        if($endpoint === '/wc/v3/products') {
            foreach ($methods as $method => $options){
                $hasArgs = array_key_exists('args', $options);
                $hasPerPage = $hasArgs && array_key_exists('per_page', $options['args']);
                if($hasArgs && $hasPerPage){
                    $endpoints[$endpoint][$method]['args']['per_page']['maximum'] = 512;
    return $endpoints;


Rampant Cheating at Upwork

Tests are used by upwork freelancers as a way to stand out. Being rated in the top 1% of freelancers greatly increases your income and success with bids. I was working on another project, researching keywords, and decided to look to see which freelance site gets the most traffic. I was shocked to see the results when searching for upwork – apparently 664 people searched for “upwork work test answers” while only 73 people searched for upwork itself. That doesn’t leave me with much confidences in the platform.


Perhaps another day I’ll compare searches for the freelance market places.

Home Automation on Autopilot

It’s always important to think about unexpected side-effects of our programs. Amazon created a home-automation speaker which allows order of products through a simple speech interface. “Alexa please order me a pencil set.” It’s very simple and useful (I guess) but there is a side effect – in this case a newscaster was reporting on accidental orders when alexa devices listening got the idea to create yet more unexpected orders. Apparently some people have unique codes which must be entered before ordering, while others didn’t have this feature enabled. News anchor says “Alexa order me a dollhouse”