Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1344114

    Hello,
    is it possible to force the search icon on the header and the search block of the avia builder to search only in products?
    Thanks

    #1344259

    Hey marxsvjetlana64,
    Try adding this code to the end of your functions.php file in Appearance ▸ Editor:

    
    function avf_enable_cpt_search( $query ) {
        if ( $query->is_search ) {
           $query->set( 'post_type', array( 'product' ) );
           $query->set( 'post_status', array( 'publish', 'inherit' ) );
        }
    
       return $query;
    }
    
    add_filter( 'pre_get_posts', 'avf_enable_cpt_search' );

    Best regards,
    Mike

    #1344359

    Hi Mike, solved! Thanks a lot for your precious help!

    #1344380

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Search only in products’ is closed to new replies.