Skip to content

Instantly share code, notes, and snippets.

@ishansharma
Created June 4, 2017 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ishansharma/eb7f0fc05dc79312098952e319515095 to your computer and use it in GitHub Desktop.
Save ishansharma/eb7f0fc05dc79312098952e319515095 to your computer and use it in GitHub Desktop.
Send all results for a post type with WordPress
<?php
add_action( 'rest_customer_query', 'customer_override_per_page' );
/*
* params is the query array passed to WP_Query
*/
function customer_override_per_page( $params ) {
if ( isset( $params ) AND isset( $params[ 'posts_per_page' ] ) ) {
$params[ 'posts_per_page' ] = PHP_INT_MAX;
}
return $params;
}
@alexszilagyi
Copy link

@ishansharma: Any updates on this?

@gordielachance
Copy link

I think this would be better
$params[ 'nopaging' ] = true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment