Skip to content

Instantly share code, notes, and snippets.

@campusboy87
Created December 21, 2018 11:06
Show Gist options
  • Select an option

  • Save campusboy87/8ddcfe6a67ce2f20d3e5691d26ea5756 to your computer and use it in GitHub Desktop.

Select an option

Save campusboy87/8ddcfe6a67ce2f20d3e5691d26ea5756 to your computer and use it in GitHub Desktop.
<?php
function filter_wp_caption_text( $content ) {
return preg_replace(
'/<p[^>]+class="wp-caption-text"[^>]*>(.+)(?=<\/p>)/s',
'<div class="wp-caption-text">\1</div>',
$content
);
}
add_filter( 'the_content', 'filter_wp_caption_text', 12 );
@campusboy87
Copy link
Copy Markdown
Author

photo_2018-12-21_14-19-40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment