Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
function vmf_limit_main_search_posts( $limit, $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
return 'LIMIT 0, 40';
}
return $limit;
}
add_filter( 'post_limits', 'vmf_limit_main_posts', 10, 2 );
<?php
function vmf_limit_main_search_posts( $limit, $query ) {
if ( ! is_admin() && $query->is_search() ) {
return 'LIMIT 0, 40';
}
return $limit;
}
add_filter( 'post_limits', 'vmf_limit_search_posts', 10, 2 );
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.