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 have added the code below to an active plugin, but it's having no effect on my posts.

add_filter( ‘the_title’, ‘myfunction’);

function myfunction($title) {
 return "Why won't this work?" . $title;

What am I missing here?

The post templates are definitely using the_title(), and the theme is normal (wp_head(), etc), and there are no conditionals surrounding the function in the plugin that would make it not run. I have also tried adding different priority in the add_filter function, from -9999 to 9999, to no effect.

share|improve this question
up vote 1 down vote accepted

Try changing this:

add_filter( ‘the_title’, ‘myfunction’);

to this:

add_filter( 'the_title', 'myfunction' );

(If this is indeed your problem it is likely an issue of copy/pasting code from a tutorial with curly quotes in place of standard single-quote marks.)

p.s. prefix your function name with your Plugin slug. "myfunction" is far too generic.

share|improve this answer
Curly quotes was it! I was going mad trying to figure that out. – supertrue Jul 10 '11 at 20:48
(Oh, and myfunction isn't the real function name.) – supertrue Jul 10 '11 at 20:49

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.