Text Replace By Define Simple Function in WordPress

Text replacement in WordPress By Define Simple Function

In WordPress replace text by define function in function.php file. By this code allow to easily define text or HTML that replace in Wodpress Post, pages or comment. By this text, replacements can easily work on the comment, post, and pages.

 

function start_modify_html() {

ob_start();
}

function end_modify_html() {

$html = ob_get_clean();
$html = str_replace( '{%imagePath%}', 'https://myfreeonlinetools.com/', $html );
echo $html;
}

add_action( 'wp_head', 'start_modify_html' );
add_action( 'wp_footer', 'end_modify_html' );

Leave a Reply

Your email address will not be published. Required fields are marked *