Created
October 14, 2017 16:03
-
-
Save andreasottosson/f6ddfcd5f3ed9ca7c8cf0aa3fce85cdb to your computer and use it in GitHub Desktop.
Show more than 100 hits in WP REST API (Wordpress)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make REST API show more than 100 results | |
add_action( 'rest_forhandlere_query', 'forhandlere_override_per_page' ); | |
/* | |
* params is the query array passed to WP_Query | |
*/ | |
function forhandlere_override_per_page( $params ) { | |
if ( isset( $params ) AND isset( $params[ 'posts_per_page' ] ) ) { | |
$params[ 'posts_per_page' ] = 500; | |
} | |
return $params; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment