Skip to content

Instantly share code, notes, and snippets.

Last active Dec 15, 2020
What would you like to do?
//Image Fix
$content = str_replace('src="/wp-content/"', 'src=""', $content);
$content = preg_replace('/(?:https?:\/\/)?(?:www\.)?gist.github\.com([^\n]+)$/sm', '<gist src="$0"></gist>', $content);
$content = preg_replace('/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([^\n]+)$/sm', '<videoblock src="$0"></gist>', $content);
//Apply the content filters
$content = apply_filters('the_content', $content);
//Remove empty paragraphs
$content = str_replace('<p></p>', '', $content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment