function change_wp_search_size($query) { if ( $query->is_search ) // Make sure it is a search page $query->query_vars['posts_per_page'] = 10; // Change 10 to the number of posts you would like to show. User -1 to show ALL return $query; // Return our modified query variables}add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom function onto the request filter
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.