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 hope this question is easy. I want to customize my theme so that the post titles are created on the fly with code. For example, I might have a post where a price changes on the page 4 times a week, and I want to be able to change my to say: Get Product X for $19.99 without having to manually edit a meta variable...

Is it possible to do?

Is there a wordpress function I can call to override the title using a plugin?

share|improve this question
up vote 2 down vote accepted

I can't answer how you'll get your dynamic data with which to update your Post Title, but you can easily hook into the Post Title, using the the_title filter:

function mytheme_dynamic_title( $title ) {
     // do something to the Post Title, which is passed
     // into this function as the variable $title
     // and then return $title
     return $title;
add_filter( 'the_title', 'mytheme_dynamic_title' );

That should get you started with hooking into the Title.

share|improve this answer
Thanks, that looks perfect to me. I knew there must be something straight forward. To get the custom content for the title, I'm running my own plugin which I think I can just add this to customize what I need. Thanks again! – Dave Johnshon May 5 '11 at 2:23

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.