• Hi,
    I’m looking for a solution. I have created a field in ACF which excludes expired products after the calendar date in this field. On the store’s website it works and hides the products, but it does not work on the entry, subpages and products search engine, i.e. in the wordpress search engine.

    I want the products to be hidden if they expire on the search results page of the wordpress search engine, i.e. after entering the keyword, I want the courses to show products, pages and entries, but the expired products are to be hidden.

    This code work in woocommerce, hides expired products

    function course_columns_head($defaults) {
        $defaults['start_day_dispaly'] = 'Data Startu Kursu';
        return $defaults;
    }
     
    // SHOW THE FEATURED IMAGE
    function course_columns_content($column_name, $post_ID) {
        if ($column_name == 'start_day_dispaly') {
            $start_curse = get_field('data_startu_kursu');
            $curent_date = date("Y-m-d"); 
    
            if ( $start_curse >= $curent_date ) {
              echo '<mark class="instock">' . $start_curse . '</mark>'; 
            }else{
              echo '<mark class="outofstock">' . $start_curse . '</mark>'; 
            }
        }
    
    }

The topic ‘Excluding meta_query from search engine results’ is closed to new replies.