Page title before site name on WordPress

I have a WP site and am trying to figure out how to place the name of the page before the site name. Essentially, I’d like to change “ABC Inc. | About Us” to “About Us | ABC Inc.”. Surprisingly, I ended up empty-handed after googling. Is this addressed by some plug-in?

Related posts

Leave a Reply

3 comments

  1. It is common to see usage of

    <title><?php wp_title('|'); bloginfo('name'); ?></title>
    

    or similar uses on the <title> tags; but according to the WordPRess Codex, it should not be used:

    The wp_title() function should not be used by a theme in conjunction
    with other strings or functions (like concatenating with
    bloginfo(‘name’)) to write the content of the element, because
    it will render plugins unable to rewrite the whole title in case the
    plugins use the wp_title filter do the rewrite, which is the best
    practice. The use of this function is now a requirement for theme
    developers.

    The best way is to include a filter in your functions.php file:

    function filter_wp_title( $title ) {
    
        $site_description = get_bloginfo( 'description' );
        $filtered_title = $title . get_bloginfo( 'name' );
        $filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
        return $filtered_title;
    }
    

    For more info on filtering the title, see the codex.

  2. If you want to use a plugin, check out WordPress SEO by Yoast. Highly recommend it. You can drill down to writing custom titles for posts, categories, tags, homepage, etc.

    Note: if it appears not to be working with your theme, click on “force rewrite titles”.