Shortcodes: Add new `strip_shortcodes_tagnames` filter.
With the new `strip_shortcodes_tagnames` filter you can specify which shortcodes are stripped by `strip_shortcodes()`. The default is all registered shortcodes. Props DylanAuty, orvils, swissspidy. Fixes #37767. Built from https://develop.svn.wordpress.org/trunk@38877 git-svn-id: http://core.svn.wordpress.org/trunk@38820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8b3c9607e5
commit
3a761adbd7
|
@ -605,7 +605,20 @@ function strip_shortcodes( $content ) {
|
||||||
|
|
||||||
// Find all registered tag names in $content.
|
// Find all registered tag names in $content.
|
||||||
preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
|
preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
|
||||||
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
|
|
||||||
|
$tags_to_remove = array_keys( $shortcode_tags );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the list of shortcode tags to remove from the content.
|
||||||
|
*
|
||||||
|
* @since 4.7.0
|
||||||
|
*
|
||||||
|
* @param array $tag_array Array of shortcode tags to remove.
|
||||||
|
* @param string $content Content shortcodes are being removed from.
|
||||||
|
*/
|
||||||
|
$tags_to_remove = apply_filters( 'strip_shortcodes_tagnames', $tags_to_remove, $content );
|
||||||
|
|
||||||
|
$tagnames = array_intersect( $tags_to_remove, $matches[1] );
|
||||||
|
|
||||||
if ( empty( $tagnames ) ) {
|
if ( empty( $tagnames ) ) {
|
||||||
return $content;
|
return $content;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-alpha-38876';
|
$wp_version = '4.7-alpha-38877';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue