I'm trying to use the_content filter which works great on regular posts or pages with template files that use the_content() function. I'm trying to use the_content filter to change the text from a template file that doesn't call the_content() anywhere.

Is there a hook that I can use to filter text?

  • 1
    If the code doesn't call the_content() function. What are you trying to change? Is the text coming from a meta field?
    – Karun
    Oct 5, 2018 at 16:09
  • 2
    Can you please be more precise.
    – Max Yudin
    Oct 5, 2018 at 16:30
  • The question you asked is not very clear so I was asking if the text you are trying to change is coming from a meta field or something else.
    – Karun
    Oct 6, 2018 at 1:26
  • The template contains all the html, so let's say I have an url inside the template, and I want to use the the_content filter to modify that url. It doesn't work for html code that is inside the template, it only works for html generated by the_content function inside the template file. (also, really appreciate the answers )
    – Andrei
    Oct 7, 2018 at 16:06

1 Answer 1


More informations needed, but maybe you'll find it by using global variables. Like:

global $post;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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