Make WordPress Core

Ticket #37906: pre_do_shortcode_tag.diff

File pre_do_shortcode_tag.diff, 1006 bytes (added by ideag, 9 years ago)

a patch to introduce pre_do_shortcode_tag filter

  • shortcodes.php

     
    321321                return $m[0];
    322322        }
    323323
     324        /**
     325         * Filters whether to call a shortcode callback.
     326         *
     327         * Passing a truthy value to the filter will effectively short-circuit the
     328         * shortcode generation process, returning that value instead.
     329         *
     330         * @since 4.7.0
     331         *
     332         * @param bool|string $return      Short-circuit return value. Either false or a URL string.
     333         * @param string      $tag         Shortcode name.
     334         * @param array       $attr        Shortcode attributes array,
     335         * @param array       $m           Regular expression match array.
     336         */
     337        $return = apply_filters( 'pre_do_shortcode_tag', false, $tag, $attr, $m );
     338        if ( false !== $return ) {
     339                return $return;
     340        }
     341
    324342        if ( isset( $m[5] ) ) {
    325343                // enclosing tag - extra parameter
    326344                return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, $m[5], $tag ) . $m[6];