Skip to content

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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.