• I made a similar thread earlier. But in this thread I will try to explain as much as possible.
    I use a custom theme based on underscores.
    In it’s function.php there are a function,
    add_theme_support( 'title-tag' );
    So as far as I understand from reading some SOF answer, if this exist, I don’t have to add below function to header.php anymore to show title of pages.
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    I removed it and my site is giving natural output as there are wp_head()included.
    <title> Title – Sitename </title>
    Now, my site have 4 post type so using a SEO plugin is not enough. So I tryed to filter wp title for different post tipe. I added bellow filter to my function.php

    function bd_wp_title( $title, $sep ) {
    	global $paged, $page;
    	if (is_singular( 'videos' )) {
    		$title = ''. get_the_title() .' '. strip_tags(get_the_term_list( get_the_ID(), 'video-categories', '', ' ', '' )) .' Download HD Mp4, 3GP Mobile';
    	}
    	if (is_singular( 'albums' )) {
    		$title = ''. get_the_title() .' Mp3 '. strip_tags(get_the_term_list( get_the_ID(), 'genre', '', ' ', '' )) .' Free download';
    	}
    	return $title;
    }
    add_filter( 'wp_title', 'bd_wp_title', 10, 2 );

    But It doesn’t works. It only works properly if I add <title><?php wp_title( '|', true, 'right' ); ?></title> into my header.php. But then, my site return two <title> tag. One within wp_title() (1) and another is the one I add in header.php (2).
    And those two title is different too. (2) gives me proper output like

    Title Mp3 genre free download

    and (1) output default one

    Title – Sitename

    .
    So, Why my filtering is not working for (1)? Am I missing something?

Viewing 1 replies (of 1 total)
  • Moderator Bet Hannon

    (@bethannon1)

    Maybe you have already fixed this, but I’ll point out that the most popular SEO plugins all handle CPTs just fine. You might not need to go to all this trouble?

    Sorry, I’m not much help with the other parts of your issue.

Viewing 1 replies (of 1 total)
  • The topic ‘Double Wp_title, Removing Title from theme doesnt solve the issue’ is closed to new replies.