Support » Plugin: The SEO Framework » Author page is “Untitled” if user has no posts

  • Resolved freshcreate

    (@freshcreate)


    On an author archive page, the default wordpress behaviour if the user has no posts is to show a “Page not found” error.

    If we want to show the user info (a bio, for example) despite no posts, we can do this by editing the author.php file with get_userdata(intval($author)), or some other similar method.

    The issue: when SEO Framework is enabled and user has no posts, the <title>, <meta property="og:title" />, and <meta property="twitter:title" /> tags all display “Untitled” instead of the author name.

    The issue is not occuring when SEO Framework is disabled. Testing was done on a plain WP installation, so no other factors should be present.

    I realize this is an edge case, but perhaps you have some insight anyway as to how to approach this – the site relies on displaying profiles of users who don’t have posts. Many thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Thank you for reporting this bug so thoroughly. It’s been there for 3 years, since v2.6.0! It’s an edge-case indeed 🙂

    I’ve created a GitHub issue on this, and a fix is already proposed for the upcoming release: https://github.com/sybrew/the-seo-framework/issues/491.

    The update is planned for next month. So, until then, this temporary filter will help you mitigate the issue:

    add_filter( 'the_seo_framework_generated_archive_title', function( $title, $term ) {
    
    	if ( is_author() ) {
    		$use_prefix = the_seo_framework()->use_generated_archive_prefix();
    		$title = $term->display_name;
    		$title = $use_prefix ? sprintf( \__( 'Author: %s', 'default' ), $title ) : $title;
    	}
    
    	return $title;
    }, 10, 2 );

    Cheers!

    Brilliant, the temporary filter worked perfectly.

    Many thanks for the prompt and stellar support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.