Created
May 2, 2020 13:57
-
-
Save dotherightthing/2a46d277b713f2bd24c22da02b68bfd2 to your computer and use it in GitHub Desktop.
Filter content #wordpress #cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter content | |
* | |
* @param string $content Content. | |
* @return string Content | |
* @example | |
* add_filter( 'the_content', 'wpdtrt_content_filter' ); | |
*/ | |
function wpdtrt_content_filter( $content ) { | |
$content = str_replace( '<h2>', '<div><h2>', $content ); | |
$content = str_replace( '</h2>', '</h2></div>', $content ); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment