Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extending a WP_Query with a callback example.
<?php
/**
* Changes the job query to show only 5 posts per page.
*
* @param array $args The current query args.
* @return array The modified query args.
*/
function wpmark_alter_job_query_args( $args ) {
// change the number of posts per page to 5.
$args['posts_per_page'] = 5;
// return the args.
return $args;
}
add_filter( 'wpmark_job_query_args', 'wpmark_alter_job_query_args' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment