I am trying to write a plugin that does something extremely simple: it searches the content and replaces “foo” with “bar” when the user publishes a page. However, I want this change to be permanent: I want it to edit the content of the post as it’s going in the database. It appears that the_content action hook only edits a post between the database and the browser. However, publish_page only allows a parameter of the post_ID, and I’m not sure how to edit the content given only an ID.
- The topic ‘Should I use publish_post or the_content?’ is closed to new replies.