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

Just wondering how to filter to change the current page title from a shortcode,

Since shortocodes are rendering after $post.

any idea to archieve something like : do_shortcode(['mytitle="newtitle"']);

share|improve this question
up vote 1 down vote accepted

why not to use the_title filter?

add_filter('the_title', 'the_title_filter');
function the_title_filter($title){
    $post = get_post(get_the_id());
    //enter code here
    return $title;

as for shortcode - its imposible. in logical way - imposible.

share|improve this answer
can you explain better? why is impossible? – greenbandit Mar 26 '12 at 20:21
It's impossible because the title has already been generated before shortcodes are parsed. – EAMann Mar 26 '12 at 20:49
You could allow shortcodes for the title (like for anything else) too. Not that it would make much sense. – kaiser Mar 26 '12 at 23:47

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.