• Resolved Filipe Seabra

    (@filiprimo)


    Hi.

    Error:

    PHP Notice: Trying to get property ‘ID’ of non-object in /var/www/html/wp-content/plugins/seo-by-rank-math/includes/frontend/class-breadcrumbs.php on line 442

    Your function should not make use of global $author:

    
    private function add_crumbs_author() {
    		global $author;
    
    		$userdata = get_userdata( $author );
    		$this->add_crumb( sprintf( $this->strings['archive_format'], $this->get_breadcrumb_title( 'user', $userdata->ID, $userdata->display_name ) ) );
    	}
    

    Instead make use of something related to the main query:

    
    private function add_crumbs_author() {
    		$userdata = get_userdata( get_query_var('author') );
    		$this->add_crumb( sprintf( $this->strings['archive_format'], $this->get_breadcrumb_title( 'user', $userdata->ID, $userdata->display_name ) ) );
    	}
    
Viewing 1 replies (of 1 total)
  • Plugin Author Rank Math SEO

    (@rankmath)

    Hello @filiprimo

    Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.

    global $author & get_query_var( 'author' ) both will return the author ID on author archive page. Probably some plugin or the theme is conflicting with Rank Math.

    Assuming you are using the latest version of all the plugins, themes and WordPress (please update if not yet), it would seem like a conflict with one of the plugins or the theme you are using.

    To determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Looking forward to helping you.

Viewing 1 replies (of 1 total)
  • The topic ‘Breadcrumbs error in author archive page’ is closed to new replies.