[wp-hackers] Is there a way to get the callback function name out of a shortcode _programmatically_?

Shea Bunge info at bungeshea.com
Mon Nov 11 21:27:25 UTC 2013


Try this:

/**

 * Retrieve the callback fuction for a shortcode tag
 * @param string $shortcode_tag The shortcode tag to retrieve the callback for
 * @return string|boolean The callback if the shortcode is registered,
false if not
 */function get_shortcode_callback( $shortcode_tag ) {
    global $shortcode_tags;

    if ( isset( $shortcode_tags[ $shortcode_tag ] ) )
        return $shortcode_tags[ $shortcode_tag ];
    else
        return false;
}



On Tue, Nov 12, 2013 at 7:12 AM, Haluk Karamete <halukkaramete at gmail.com>wrote:

> Is there a way to get the callback function name out of a shortcode
> _programmatically_?
>
> for example
>
> get_shortcode_callback_for('caption')
>
> would return
>
> "img_caption_shortcode"
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Regards,

Shea Bunge
http://bungeshea.com


More information about the wp-hackers mailing list