WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use a custom post called "abschreibungstabelle".

For all posts, I want to set the meta title dynamically:

"This is a test: " & the post title

Is there any easy way to do this:

Actually I use the following snippet in my header:

        <?php if ( is_plugin_inactive('wordpress-seo/wp-seo.php') ) {
               bloginfo( 'name' );
              } ?> <?php wp_title("|", true); ?>

The result is "post title" | my blog

Thank you, cheers!

share|improve this question
up vote 0 down vote accepted

I use something like this in my header.php:

        echo "Front Page Title";
    else if(is_404())
        echo "Page Not Found";
    echo ' | '.get_bloginfo('name');  

Check out Conditional Tags for more information.

As a Function() :


function setTitle(){
    global $post;

    $title = get_the_title();
    $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

        $title = $term->name;
    else if(is_search())
        $title = "Search";
    else if(is_404())
        $title = "Page Not Found";

        $terms = get_the_terms( $post->ID, 'customCPT' ); 
        $term = array_pop($terms);
        $title = $term->name.' '.$title;

    echo $title.'  |  '.get_bloginfo('name');

Then in your header.php

<title><?php setTitle(); ?></title>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.