Non-Object error on author pages
-
Hi there,
on my author archive pages I’m getting a notice mentioning:Notice: Trying to get property ‘ID’ of non-object in XXXXXX/httpdocs/wp-content/plugins/custom-sidebars/inc/class-custom-sidebars-replacer.php on line 596
Any idea, why this happens here and how to fix it? I’m using PHP 7.3.19 on my server.
Thanks a lot!
Edit: Seems, that get_queried_object() is not defined on author archives, so
$author_object = get_queried_object(); $current_author = $author_object->ID;
leads to this problem.
$current_author = get_the_author_meta('ID');
seems to work instead
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Non-Object error on author pages’ is closed to new replies.