campusboy87
12/21/2018 - 11:06 AM

filter_wp_caption_text.php

<?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 );