2

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?

1 Answer 1

6

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.