Support » Plugin: Relevanssi - A Better Search » Products indexed, but no posts

  • Resolved Franz92


    Hi Mikko,
    first of all: Thank you for this plug-in. I like it, but seem to misunderstand how to get it running.

    I’ve gone through the setup, but can’t get posts to show up – only products.

    For example: For the keyword “BPMA” this post should show up. But it doesn’t.

    I’ve set the type “post” to index and it’s not excluded from search. I’ve rebuilt the index a couple of times, but I am not making headway. Do you have any idea what goes wrong?

    Thank you so much,

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari


    It’s your theme.

    When you search for “BPMA”, you’ll see the search results page URL looks like this:

    Notice the post_type=product in there? That restricts the results to products only. Remove that and you get:

    which finds the post you want to find.

    Your search form includes this:

    <input type="hidden" name="post_type" value="product">

    This is what adds the post type restriction to the search. You can remove it from the search form to make the search find all post types, but it’s worth noting that your theme – like many WooCommerce themes – only shows the product search layout when the parameter is present. When it’s not there, you’ll get a different search results layout.

    If you don’t know how to edit the search form, you can also add this to your theme functions.php file to make the search include also posts:

    add_filter( 'relevanssi_modify_wp_query', 'rlv_force_post_product' );
    function rlv_force_post_product( $query ) {
        $query->query_vars['post_types'] = 'post,product';
        return $query;
    Thread Starter Franz92


    Hi Mikko,
    thank you for your quick reply. That was very helpful – I’ve understood the problem at hand and how the the inner workings work here.

    I’ve added the code to the functions.php as well as the functions-enfold.php, because I can’t edit the search form.

    However it seems that it doesn’t take effect. I will talk to the Enfold support about this.

    Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Products indexed, but no posts’ is closed to new replies.