- This topic has 12 replies, 2 voices, and was last updated 4 years, 6 months ago by
Tom.
-
AuthorPosts
-
November 29, 2018 at 5:33 am #743653
Alain Aubry
Hi
I don’t visually see any problem, but when I enable “debug” I see 3 lines with the following texts:Notice: Trying to get property of non-object in /home/…/wp-content/plugins/wordpress-seo/frontend/class-frontend.php on line 717
Notice: Trying to get property of non-object in /home/…/wp-content/plugins/wordpress-seo/frontend/class-frontend.php on line 720
Notice: Trying to get property of non-object in /home/…/wp-content/plugins/wordpress-seo/frontend/class-breadcrumbs.php on line 399As these lines points to wordpress-seo, I opened a ticket at: https://wordpress.org/support/topic/get-property-of-non-object/
After following their suggestions I found the fault at my “GeneratePress Child Theme”. It just happens in Author pages when the child theme is enabled, otherwise works fine.I am bringing this here in order to find some suggestions to diagnose, how to find the faulty script. I have a big amount of functions and actions in my functions.php, many recommended here or in some other sources.
Thanks
AlainNovember 29, 2018 at 9:56 am #743993Tom
Lead DeveloperLead DeveloperHi there,
Do you have any functions in your child theme? If so, can you share them?
November 29, 2018 at 11:29 am #744077Alain Aubry
Hi Tom
I have lots of functions…
They were tested individually before going live.
The only place where the word author is found is here (two places):// GP Set CPT Image Positions add_filter( 'option_generate_blog_settings', 'indigo_cpt_options' ); function indigo_cpt_options( $options ) { if ( is_post_type_archive( array( 'actividade', 'colaborador', 'course' ) ) OR is_tax( array( 'grupo', 'tipo' ) ) OR is_search() ) { $options[ 'masonry' ] = true; $options[ 'infinite_scroll' ] = true; $options[ 'post_image_padding' ] = false; $options[ 'post_image_position' ] = 'post-image-above-header'; $options[ 'post_image_alignment' ] = 'post-image-aligned-center'; $options[ 'author' ] = false; $options[ 'comments' ] = false; } if ( is_post_type_archive( 'evento' ) ) { $options[ 'masonry' ] = false; $options[ 'infinite_scroll' ] = true; $options[ 'post_image' ] = true; $options[ 'post_image_padding' ] = true; $options[ 'post_image_position' ] = 'below-title'; $options[ 'post_image_alignment' ] = 'left'; $options[ 'author' ] = false; $options[ 'comments' ] = false; } if ( is_singular( 'colaborador' ) ) { $options[ 'single_post_image' ] = true; $options[ 'single_post_image_padding' ] = true; $options[ 'single_post_image_position' ] = 'below-title'; $options[ 'single_post_image_alignment' ] = 'left'; $options[ 'author' ] = false; $options[ 'comments' ] = false; } return $options; } // End GP Set CPT Image Positions
and
// Insert Yoast WPSEO Breadcrumbs */ add_action( 'generate_before_main_content', 'indigo_breadcrumbs' ); function indigo_breadcrumbs() { if ( function_exists( 'yoast_breadcrumb' ) && is_single() && 'lesson' !== get_post_type() ) : // && 'lesson' !== get_post_type() && ! is_author() yoast_breadcrumb( '<div class="inside-article"><p id=”breadcrumbs”>', '</p></div>' ); endif; } // END Insert Yoast WPSEO Breadcrumbs */
This second one ‘author’ is in a comment…
Thanks
AlainNovember 29, 2018 at 11:30 am #744080Alain Aubry
I am planning disabling all the “actions” one by one, as I did with the plugins.
November 29, 2018 at 5:39 pm #744320Tom
Lead DeveloperLead DeveloperThat’s a good idea – let me know if you can pinpoint the function 🙂
December 2, 2018 at 11:11 am #746175Alain Aubry
OK, I found the function that causing the problem, but it does not make any sense.
I am going the share the faulty function:// Indigo Adjust Main Queries add_action( 'pre_get_posts', 'indigo_adjust_queries' ); function indigo_adjust_queries( $query ) { if ( !is_admin() && is_post_type_archive( 'actividade' ) && $query->is_main_query() ) : $query->set( 'post_per_page', -1 ); $query->set( 'orderby', 'post_modified' ); $query->set( 'order', 'DESC' ); endif; // actividade if ( !is_admin() && is_post_type_archive( 'colaborador' ) && $query->is_main_query() ) : $query->set( 'post_per_page', -1 ); $query->set( 'orderby', array( 'relation' => 'AND', array( 'orderby' => 'menu_order', 'order', 'ASC' ), array( 'orderby' => 'post_title', 'order', 'ASC' ) )); endif; // colaborador if ( !is_admin() && is_post_type_archive( 'evento' ) && $query->is_main_query() ) : $today = date('Ymd'); $query->set( 'post_per_page', -1 ); $query->set( 'post_type', 'evento' ); $query->set( 'meta_key', 'data_do_evento' ); $query->set( 'orderby', 'meta_value_num' ); $query->set( 'order', 'ASC' ); $query->set( 'meta_query', array( array( 'key' => 'data_do_evento', 'compare' => '>=', 'value' => $today, 'type' => 'numeric' ) )); endif; // evento if ( !is_admin() && is_post_type_archive( 'course' ) && $query->is_main_query() ) : $query->set( 'post_per_page', -1 ); $query->set( 'orderby', 'post_modified' ); $query->set( 'order', 'DESC' ); endif; // course $term = single_term_title( '', false ); if ( $term ) : if ( !is_admin() && is_tax( 'grupo' ) && $query->is_main_query() ) : $query->set( 'post_per_page', -1 ); $query->set( 'post_type', 'colaborador' ); $query->set( 'orderby', 'menu_order' ); $query->set( 'order', 'ASC' ); $query->set( 'tax_query', array( array( 'taxonomy' => 'grupo', 'field' => 'name', 'operator' => 'IN', 'terms' => $term ) )); endif; // colaborador if ( !is_admin() && is_tax( 'tipo' ) && $query->is_main_query() ) : $query->set( 'post_per_page', -1 ); $query->set( 'post_type', 'actividade' ); $query->set( 'orderby', 'post_modified' ); $query->set( 'order', 'DESC' ); $query->set( 'tax_query', array( array( 'taxonomy' => 'tipo', 'field' => 'name', 'operator' => 'IN', 'terms' => $term ) )); endif; // actividade endif; // terms } // END indigo_adjust_queries
I will continue splitting this function into parts, maybe I can find it…
Thanks
December 2, 2018 at 2:12 pm #746277Alain Aubry
Something is wrong here:
$term = single_term_title( '', false );
December 2, 2018 at 5:56 pm #746370Tom
Lead DeveloperLead DeveloperI’m not sure what would trigger that warning in Yoast SEO, unfortunately. Have you shared the problem function with them?
December 3, 2018 at 12:26 am #746481Alain Aubry
They closed my ticket as resolved previously, as the problem is located in my child theme I agreed in closing. I will share again.
It is shared here:
https://wordpress.org/support/topic/get-property-of-non-object/#post-10940723They have an open ticket in Github:
https://github.com/Yoast/wordpress-seo/pull/10905December 3, 2018 at 4:34 am #746588Alain Aubry
Hi Tom
You should read this:
https://wordpress.org/support/topic/get-property-of-non-object/#post-10940996December 3, 2018 at 8:28 am #746881Tom
Lead DeveloperLead DeveloperIt seems he gave you a solution here: https://wordpress.org/support/topic/get-property-of-non-object/#post-10941663
December 3, 2018 at 11:01 am #747039Alain Aubry
Yes, the solution is working, I only tried local.
Thank you for being present and supportive…December 3, 2018 at 5:15 pm #747268Tom
Lead DeveloperLead DeveloperGreat to hear 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.