Skip to content

Instantly share code, notes, and snippets.

@kkarpieszuk
Created February 20, 2020 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkarpieszuk/0e7568ef56c6f825214cc6cf5da2b252 to your computer and use it in GitHub Desktop.
Save kkarpieszuk/0e7568ef56c6f825214cc6cf5da2b252 to your computer and use it in GitHub Desktop.
Replace WordPress word with link to the site in WordPress post content
<?php
// add code below to functions.php file of your theme
add_filter( 'the_content', function( $content ) {
if ( ! is_admin() ) {
$content = str_replace( 'WordPress', '<a href="https://wordpress.org">WordPress</a>', $content );
}
return $content;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment