Get WPFTS Pro today with 25% discount!

Number of search results

Bugs and Fixes
5 2 1.3k 2

  • 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 filter

    But i only get 5 results (always, for any keyword, even if there are more results)

    Kind regards, Marco


  • Hi @webwerkplaats

    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.


  • Hi @webwerkplaats

    The Divi Builder has its own "Number of Posts" settings which overrides your code, I guess.

    E20210121-143835-001[1].png

    Did you try to change that?


  • i feel stupid now...YES! It works...

Suggested Topics

  • PDFs not appearing in search result

    Bugs and Fixes
    2
    0 Votes
    2 Posts
    824 Views
    EpsilonAdminE
    Hi @blixhavn Do you remember which plugins you've installed recently? Some of them may conflict with WPFTS Pro, especially when making a search at the front end. Please try to disable those plugins temporarily. If it does not help, let's connect with TeamViewer so I can solve this issue faster (write me a private message or via Live Chat at the main page).
  • Multi word search showing an empty screen

    Bugs and Fixes
    3
    1 Votes
    3 Posts
    886 Views
    W
    @EpsilonAdmin - Thank you, that worked. We appreciate the help!
  • Add button or menu link to search results

    Bugs and Fixes
    7
    0 Votes
    7 Posts
    2k Views
    EpsilonAdminE
    Hi @melanie-james First of all, to see attachment contents in Smart Excerpts with Avada theme you need to implement a small patch, which removes the incompatibility of Avada theme. Please read more here https://fulltextsearch.org/forum/topic/11/solved-avada-theme-excerpt-do-not-show
  • Very slow search query on large wordpress site

    Bugs and Fixes
    13
    0 Votes
    13 Posts
    3k Views
    mazcabralM
    @EpsilonAdmin Great! but I still haven't received the email with the link. If possible, please send me back so that I can install and do the tests. Thank you so much!
  • 1 Votes
    2 Posts
    1k Views
    EpsilonAdminE
    Hi, Vasiliki Thank you for the question! Yes, initially WPFTS Pro was only able to search within files that are included in WP Media Library. We are developing an addon currently which will enable search by any file or file directory. ETA of the test version is 25 Apr 2020.

Be the first to read the news!

We are always improving our products, adding new functions and fixes. Subscribe now to be the first to get the updates and stay informed about our sales! We are not spammy. Seriously.

Join Us Now!

We are a professional IT-team. Many of us have been working in a Web IT field for more than 10 years. Our advanced experience of software development has been employed in the creation of the WordPress FullText Search plugin. All solutions implemented into the plugin have been used for 5 or more years in over 60 different web-projects.

We are looking forward to your comments, requests and suggestions in relation to the current plugin and future updates.

ewm-logo-450

The forum powered by NodeBB | Contributors