Is it possible to process an entire wordpress page (by page I mean the response to any requested url in the site) html with a regex before it gets sent to the client? Is this best achieved by the server rather than php, and how would it get done in apache?
Share
Start output buffering on the beginning with
ob_start(), at the end get the contents with$content = ob_get_contents(); ob_end_clean();. You can then run regex on your content withpreg_replaceand then justecho $content;Example