WordPress.org

Forums

Can I make source search/replaces before output? (1 post)

  1. wilsonf1
    Member
    Posted 1 year ago #

    I found this function which can replace text inside the content of your article before posting:

    function replace_content($content)
    {
    $content = str_replace('Company Name', '<span class="company">Company Name</span>',$content);
    return $content;
    }
    add_filter('the_content','replace_content');

    Is there anyway to search and replace text in the entire source code? I'd ideally like to make some changes to some url's in href parameters before outputting to the browser.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic