How to removing the pipe from Title tag?

Hi,

I am having a very hard time removing the pipe in the title tag.

I have tried below code, but did not work.
add_filter( ‘wp_title’, function() {
return get_the_title();
});

Wordpress ver - 4.7.3
X theme - 4.5.3
Convertplug - 2.4.1

Thanks in advance.

Hi There,

Could you please provide us with your website URL so we can take a closer look?

Thanks.

Hi Thai,

I managed to get rid of the I / pipe from the page Title, using one of SEO plugin.

I was more interested to know, how to do it with in the code?

Thanks.

Hi There,

Try this function instead, replace the | with the desired separator. Add it on your child theme’s functions.php file.


 // Filter <title> Output
// =============================================================================

if ( ! function_exists( 'x_wp_title' ) ) :
  function x_wp_title( $title ) {

    if ( is_front_page() ) {
      return get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'description' );
    } elseif ( is_feed() ) {
      return ' | RSS Feed';
    } else {
      return trim( $title ) . ' | ' . get_bloginfo( 'name' ); 
    }

  }
  add_filter( 'wp_title', 'x_wp_title' );
endif;

Hope it helps,
Cheers!

Hi,

I applied above code, but did not work. Back to the Plugin.

Thanks.

Hi There,

It is possible that the function did not work because your SEO plugin is overriding it. Try the code with the SEO plugin deactivated.

Thanks,

Hi,

I exactly did the same, disabled the SEO Plugin and checked with your suggested code. But hard luck.

Hi There,

If you’re using any caching plugins, make sure to purge your server cache. Provide us with your FTP credentials to check this issue further.

Thanks!