Forum Replies Created

Viewing 1 replies (of 1 total)
  • i found a work-around for this problem. add the following code to your theme’s functions.php and wou should get the correct results first but still all the rest of your products follow (at least ajax cached so it shoulnd’t slow down your website)

    add_action( 'pre_get_posts', 'tgm_cpt_search' );
    add_filter( 'pre_get_posts', 'tgm_cpt_search' );
    /**
     * This function modifies the main WordPress query to include an array of post types instead of the default 'post' post type.
     *
     * @param mixed $query The original query
     * @return $query The amended query
     */
    function tgm_cpt_search( $query ) {
        if ( $query->is_search )
    		$query->set( 'post_type', array( 'post', 'page', 'product' ) );
        return $query;
    };

Viewing 1 replies (of 1 total)