Wednesday, August 10, 2022
HomeWordPress DevelopmentWarning: Try to learn property "term_id" on int - Woocommerce

Warning: Try to learn property "term_id" on int – Woocommerce


I wish to create a situation to manually disguise product classes inside the store. I already began from a code base however I’m attempting to grasp why if I put the is_product_category() situation the error comes out as I specified within the query with PHP Model 8.0

That is the code:

add_filter( 'get_terms', 'sct_hide_cat', 10, 3 );

operate sct_hide_cat( $phrases, $taxonomies, $args ) {

international $product;
$exclude = [50, 22, 20, 31, 35, 45, 40, 65, 37, 40, 3434];
$new_terms = [];

if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() && is_shop() || is_product_category() ) {
    foreach ( $phrases as $key => $time period ) {
        if ( ! in_array( $term->term_id, $exclude ) ) { 
            $new_terms[] = $time period;
        }
    }
    $phrases = $new_terms;
}
return $phrases;
}
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments