Can I edit blogs output content in blogs page? What is the correct way to do it? I assume there must be a filter function, the name of which I don't know.

  • Could you please clarify what you mean by "blogs page?" Do you mean the default archive, which shows your latest posts in either full or excerpt form? Or are you working with a MultiSite with multiple blogs?
    – WebElaine
    Sep 18 '17 at 13:18

There is a filter called the_content which you can use to do anything you like with the content. If you want to constrain this to certain pages, you must add an extra condition. It is not completely clear what you mean by 'blogs page'. The condition for the blogs home page is is_home or else you might need is_archive. Like this:

add_filter ('the_content','wpse280327_the_content');
function wpse280327_the_content ($content) {
  if (is_home) { 
    ... do stuff with $content ...
  return $content;
  • Not exactly what I need. I need a filter to edit EACH blog's content in blogs list page.
    – giacoder
    Sep 18 '17 at 11:43
  • You mean you need a front-end editor? There are plugins that do this.
    – cjbj
    Sep 18 '17 at 13:38
  • Nope, I mean there is a blogs page with list of blogs. 'the_content' is the content of whole page. I need a filter for each job separately
    – giacoder
    Sep 18 '17 at 19:04

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.