решил это как можно лучше, комбинируя слегка измененную функцию parse_shortcode_content от Донала МакАртура (его изначально вручную вызывается wpautop ... который я удалил. С переупорядочением фильтров по умолчанию для запуска wpautop гораздо позже ... после того, как шорткод уже обработан вместо ранее.
//Clean Up WordPress Shortcode Formatting - important for nested shortcodes
//adjusted from http://donalmacarthur.com/articles/cleaning-up-wordpress-shortcode-formatting/
function parse_shortcode_content( $content ) {
/* Parse nested shortcodes and add formatting. */
$content = trim( do_shortcode( shortcode_unautop( $content ) ) );
/* Remove '' from the start of the string. */
if ( substr( $content, 0, 4 ) == '' )
$content = substr( $content, 4 );
/* Remove '' from the end of the string. */
if ( substr( $content, -3, 3 ) == '' )
$content = substr( $content, 0, -3 );
/* Remove any instances of ''. */
$content = str_replace( array( '<p></p>' ), '', $content );
$content = str_replace( array( '<p> </p>' ), '', $content );
return $content;
}
и перемещение фильтров
//move wpautop filter to AFTER shortcode is processed
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 );
РЕДАКТИРОВАТЬ:
Функция parse_shortcode_content()
больше не требуется (если она когда-либо была). Просто настройте порядок фильтра.