Support » Plugin: Yoast SEO » Not showing a category in posts title tag?

  • Hi.

    I currently have my title template for posts set up like this:

    %%title%% · %%category%%

    The problem is, one of the categories is something I just use for reference in the site structure (it basically serves as a marker “important”) and isn’t usually displayed to the user. So when I post a topic that’s marked with the “important” category, it displays as something like this: Post title · category 1, “important”.

    I have the php code to get rid of the important label using WordPress’s get_the_category function, however I’m not sure whether it’s possible to use that within the WordPress SEO plugin.

    A solution I thought of was to clear the title template area for posts in WordPress SEO (theoretically so that nothing about the title tag for posts gets injected in the header) and to insert the needed code in the header manually for posts. However I’m not sure if this would be possible while maintaining the basic title template needed for WordPress SEO in the header.php:

    <title><?php wp_title (''); ?></title>.

    Would it be possible to add a rule in header.php for post titles using an if function or something of that nature? Is clearing the title tag area in WordPress SEO even a good idea? Or maybe this purpose could be achieved in a more convenient way?

    I would be glad if you could share your ideas on this. I really need to get rid of that category in the title tags one way or another.



Viewing 1 replies (of 1 total)
  • Hi again. It’s unfortunate this thread hasn’t generated any interest. I’ve been working on a solution and here’s some thoughts on this issue:

    1) Would it be possible to set a custom title for single posts through the if is_single function and the required WordPress SEO title (<title><?php wp_title (”); ?></title>) for everything else through php else?

    2) I was able to pinpoint these lines in wpseo-functions.php:

    '%%category%%'     => wpseo_get_terms( $r->ID, 'category' ),
    function wpseo_get_terms( $id, $taxonomy, $return_single = false ) {
    	// If we're on a specific tag, category or taxonomy page, return that and bail.
    	if ( is_category() || is_tag() || is_tax() ) {
    		global $wp_query;
    		$term = $wp_query->get_queried_object();
    		return $term->name;

    Perhaps altering this could allow for excluding a single category?



Viewing 1 replies (of 1 total)
  • The topic ‘Not showing a category in posts title tag?’ is closed to new replies.