TRYING TO GET PROPERTY ‘SLUG’ OF NON-OBJECT
-
Hello all,
It’s probably a syntax issue, but I got this while enabling the following snippet: ”Trying to get property ‘slug’ of non-object”.
It’s for hiding product cats and works fine but there is this error in logs.
Can you help?add_filter( ‘get_terms’, ‘filter_get_terms’, 10, 3 ); function filter_get_terms( $terms, $taxonomies, $args ) { $new_terms = []; // if a product category and on the shop page if ( ! is_admin() ) { foreach ( $terms as $term ) { if ( ! in_array( $term->slug, [ ‘hors-saison’, ‘non-classe’ ] ) ) { $new_terms[] = $term; } } $terms = $new_terms; } return $terms; }
Thanks
Best regards
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘TRYING TO GET PROPERTY ‘SLUG’ OF NON-OBJECT’ is closed to new replies.