Trying to get property of non-object in class-astra-target-rules-fields.php
-
Version 1.6.10
Have started receiving this a few times a day in debug logs. Must be occurring just on a few WC posts. However, should not cause a failure.
PHP Notice: Trying to get property ‘post_type’ of non-object in
/home/blanked/public_html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php on line 1324
PHP Notice: Trying to get property ‘ID’ of non-object in /home/blanked/public_html/wp-content/plugins/header-footer-elementor/inc/lib/target-rule/class-astra-target-rules-fields.php on line 1325which are these lines
$taxonomies = get_object_taxonomies( $q_obj->post_type ); $terms = wp_get_post_terms( $q_obj->ID, $taxonomies );
Looks like these lines and the succeeding foreach should be wrapped with an is_object check per line 1299. eg.
if ( is_object( $q_obj ) ) { $taxonomies = get_object_taxonomies( $q_obj->post_type ); $terms = wp_get_post_terms( $q_obj->ID, $taxonomies ); foreach ( $terms as $key => $term ) { $meta_args .= " OR pm.meta_value LIKE '%\"tax-{$term->term_id}-single-{$term->taxonomy}\"%'"; } }
- The topic ‘Trying to get property of non-object in class-astra-target-rules-fields.php’ is closed to new replies.