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.
Try changing this:
to this:
(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.