@ibloom
Thank you, this is actually the thing which I would like to recommend you to do.
Number of search results
-
Does WPFTS limit number of search results?
I have set Settings>Read to 100 posts (in WP Admin)
i have added to my child theme's functions.php:
function change_wp_search_size($query) {
if ( $query->is_search ) // Make sure it is a search page
$query->query_vars['posts_per_page'] = 50; // Change 10 to the number of posts you would like to show
return $query; // Return our modified query variables
}
add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom function onto the request filterBut i only get 5 results (always, for any keyword, even if there are more results)
Kind regards, Marco
-
No, WPFTS does not control this parameter.
The reason why you don't see any changes may be because the code is wrong.
Please try this code instead:add_action('pre_get_posts', function(&$query) { $query->set('posts_per_page', 50); });
Notice: 'pre_get_posts' is an action , you don't need to return something from it.
The parameter $query should be sent as reference (with &).Let me know if this helps.
-
I'm sorry, no, it doesn't help.
This site is weird. I have made prototype on 1 server. Then copied it 1:1 to another server. There some links don't work. Previous page, Next page pagination and the Divi Theme builder only work when i set permalinks in Wordpress to "Simple". When i change permalinks to "Post Name" or any other, the site misbehaves. Can't figure it out. Maybe this is also the reason the site doesn't "listen" to my code or your code to expand the number of search results.
Thanks for the help but it seems the error is not in your plugin. -
The Divi Builder has its own "Number of Posts" settings which overrides your code, I guess.
Did you try to change that?
-
i feel stupid now...YES! It works...