Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.