do_shortcode_tag

The timeline below displays how wordpress function do_shortcode_tag has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m {
 *     Regular expression match array.
 *
 *     @type string $0 Entire matched shortcode text.
 *     @type string $1 Optional second opening bracket for escaping shortcodes.
 *     @type string $2 Shortcode name.
 *     @type string $3 Shortcode arguments list.
 *     @type string $4 Optional self closing slash.
 *     @type string $5 Content of a shortcode when it wraps some content.
 *     @type string $6 Optional second closing bracket for escaping shortcodes.
 * }
 * @return string Shortcode output.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        _doing_it_wrong(
            __FUNCTION__,
            /* translators: %s: Shortcode tag. */
            sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag),
            '4.3.0'
        );
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $output Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or the original arguments string if it cannot be parsed.
     * @param array        $m      Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or the original arguments string if it cannot be parsed.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 6.3

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m {
 *     Regular expression match array.
 *
 *     @type string $0 Entire matched shortcode text.
 *     @type string $1 Optional second opening bracket for escaping shortcodes.
 *     @type string $2 Shortcode name.
 *     @type string $3 Shortcode arguments list.
 *     @type string $4 Optional self closing slash.
 *     @type string $5 Content of a shortcode when it wraps some content.
 *     @type string $6 Optional second closing brocket for escaping shortcodes.
 * }
 * @return string Shortcode output.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        _doing_it_wrong(
            __FUNCTION__,
            /* translators: %s: Shortcode tag. */
            sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag),
            '4.3.0'
        );
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $output Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or the original arguments string if it cannot be parsed.
     * @param array        $m      Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or the original arguments string if it cannot be parsed.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 6.2

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array.
 * @return string|false Shortcode output on success, false on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        _doing_it_wrong(
            __FUNCTION__,
            /* translators: %s: Shortcode tag. */
            sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag),
            '4.3.0'
        );
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $output Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 6.1

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array.
 * @return string|false Shortcode output on success, false on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        _doing_it_wrong(
            __FUNCTION__,
            /* translators: %s: Shortcode tag. */
            sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag),
            '4.3.0'
        );
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $return Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 5.8

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array.
 * @return string|false Shortcode output on success, false on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        _doing_it_wrong(
            __FUNCTION__,
            /* translators: %s: Shortcode tag. */
            sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag),
            '4.3.0'
        );
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 5.7

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array.
 * @return string|false Shortcode output on success, false on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: Shortcode tag. */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 5.6

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex() for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: Shortcode tag. */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 5.4

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // Allow [[foo]] syntax for escaping a tag.
    if ('[' === $m[1] && ']' === $m[6]) {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: Shortcode tag. */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 5.3

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: Shortcode tag. */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Returning a non-false value from filter will short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param false|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 5.1

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 *
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: shortcode tag */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Passing a truthy value to the filter will effectively short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param bool|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 4.9

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: shortcode tag */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Passing a truthy value to the filter will effectively short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param bool|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string       $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 4.8

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: shortcode tag */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Passing a truthy value to the filter will effectively short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param bool|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string       $tag         Shortcode name.
     * @param array|string $attr        Shortcode attributes array or empty string.
     * @param array        $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string $output Shortcode output.
     * @param string       $tag    Shortcode name.
     * @param array|string $attr   Shortcode attributes array or empty string.
     * @param array        $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 4.7

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: shortcode tag */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    /**
     * Filters whether to call a shortcode callback.
     *
     * Passing a truthy value to the filter will effectively short-circuit the
     * shortcode generation process, returning that value instead.
     *
     * @since 4.7.0
     *
     * @param bool|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
     * @param string      $tag         Shortcode name.
     * @param array       $attr        Shortcode attributes array,
     * @param array       $m           Regular expression match array.
     */
    $return = apply_filters('pre_do_shortcode_tag', false, $tag, $attr, $m);
    if (false !== $return) {
        return $return;
    }
    $content = isset($m[5]) ? $m[5] : null;
    $output = $m[1] . call_user_func($shortcode_tags[$tag], $attr, $content, $tag) . $m[6];
    /**
     * Filters the output created by a shortcode callback.
     *
     * @since 4.7.0
     *
     * @param string $output Shortcode output.
     * @param string $tag    Shortcode name.
     * @param array  $attr   Shortcode attributes array,
     * @param array  $m      Regular expression match array.
     */
    return apply_filters('do_shortcode_tag', $output, $tag, $attr, $m);
}

WordPress Version: 4.4

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        /* translators: %s: shortcode tag */
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    if (isset($m[5])) {
        // enclosing tag - extra parameter
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $tag) . $m[6];
    } else {
        // self-closing tag
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, null, $tag) . $m[6];
    }
}

WordPress Version: 4.3

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 *
 * @global array $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return string|false False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (!is_callable($shortcode_tags[$tag])) {
        $message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
        _doing_it_wrong(__FUNCTION__, $message, '4.3.0');
        return $m[0];
    }
    if (isset($m[5])) {
        // enclosing tag - extra parameter
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $tag) . $m[6];
    } else {
        // self-closing tag
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, null, $tag) . $m[6];
    }
}

WordPress Version: 3.9

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5.0
 * @access private
 * @uses $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return mixed False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (isset($m[5])) {
        // enclosing tag - extra parameter
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $tag) . $m[6];
    } else {
        // self-closing tag
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, null, $tag) . $m[6];
    }
}

WordPress Version: 3.7

/**
 * Regular Expression callable for do_shortcode() for calling shortcode hook.
 * @see get_shortcode_regex for details of the match array contents.
 *
 * @since 2.5
 * @access private
 * @uses $shortcode_tags
 *
 * @param array $m Regular expression match array
 * @return mixed False on failure.
 */
function do_shortcode_tag($m)
{
    global $shortcode_tags;
    // allow [[foo]] syntax for escaping a tag
    if ($m[1] == '[' && $m[6] == ']') {
        return substr($m[0], 1, -1);
    }
    $tag = $m[2];
    $attr = shortcode_parse_atts($m[3]);
    if (isset($m[5])) {
        // enclosing tag - extra parameter
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, $m[5], $tag) . $m[6];
    } else {
        // self-closing tag
        return $m[1] . call_user_func($shortcode_tags[$tag], $attr, null, $tag) . $m[6];
    }
}