Make WordPress Core


Ignore:
Timestamp:
09/02/2016 12:09:42 AM (10 years ago)
Author:
pento
Message:

Shortcodes: Add the pre_do_shortcode_tag filter.

This filter allows the shortcode generation process to be short-circuited, so expensive short codes can be cached and returned immediately.

Props ideag.
Fixes #37906.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/shortcodes.php

    r37865 r38506  
    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 the value to replace the shortcode with.
     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
Note: See TracChangeset for help on using the changeset viewer.