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.

Hi I have a problem with the_title filter:

I have this code at my constructor:

add_filter( 'the_title', array($this, 'change_title') );

and this as callback (for testing purposes)

 public function change_title($title)
 {
    return 'title';                 
 }

But is filtering my navigation items! instead of show home, pages, etc all changed to 'title' screenshoot

Any Ideas how to fix it?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

You can try the in_the_loop() conditional to check if the context of the_title is within the loop.

share|improve this answer
    
like a charm, thank you! –  greenbandit Mar 29 '12 at 16:22
add comment

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.