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

Is it possible to have my custom permalink structure on title tag of my blog?

my current permalink structure is this /%postname%/%location%/%mba_courses%/ where my location and mba_courses are custom taxonomies

Now I want this on my title tag, can I write something like this in title tag?

<title><?php echo (/%postname%/%location%/%mba_courses%/); ?><title>

I know this is a wrong code, and it won't work, but is their any way, where I can have this kind of title tag?

share|improve this question
up vote 1 down vote accepted

There is no way to cause your permalink structure to be reflected automatically in the title tag. Instead, you must create it yourself. This might get you started: (I had to make a lot of assumptions in this code.)

function my_title() {
    $post = get_queried_object();
    $locations = wp_get_object_terms( $post->ID, 'location' );
    $mba_courses = wp_get_object_terms( $post->ID, 'mba_courses' );
    $postname = $post->post_title;
    $location = $locations[0]->name;
    $mba_course = $mba_courses[0]->name;
    return "$postname | $location | $mba_course";

Then, in your single post template:

<title><?php echo my_title(); ?><title>
share|improve this answer

If your not using an SEO plugin you can use wp_title to put the permalink url as the tile.

<title><?php wp_title(' '); ?></title>
share|improve this answer
sorry for the above comment, but this is not what I want, My URL structure is in this way MBA-IN-INSEAD(post-name)/MBA-IN-FRANCE(location)/MBA-IN-ACCOUNTS(course name) In terms of SEO this is the best URL for an MBA website, so in same way I want it for my title tag, which should be something like this: MBA IN INSEAD | MBA IN FRANCE | MBA-IN-ACCOUNTS – ntechi Feb 28 '11 at 13:05
@ntechi I misunderstood your question. I thought you wanted the url in the title tag. – Chris_O Feb 28 '11 at 13:34
its actually the URL's text, you are not completely wrong, but how can this be done? – ntechi Feb 28 '11 at 13:36

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.