You get all shortcodes, there are registered in WordPress with the default function in the global $shortcode_tags
. You can loop about this shortcodes and filter via tag or functiion.
foreach( $shortcode_tags as $tag => $function ) {
}
If the $function
is a array, then can also read the parameters. See the source below. I think the source is easier to understand as my english 😉
/**
* Get all shortocdes and his data
*
* @return String
*/
function get_shortcodes() {
global $shortcode_tags;
$style="";
$output="<h4>Total Shortcodes: " . count( $shortcode_tags ) . '</h4>';
$output .= '<ol>';
foreach( $shortcode_tags as $tag => $function ) {
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
if ( is_string( $function ) ) {
$function = '<code>' . $function . '</code>';
} else if ( is_array( $function ) ) {
$object="";
$parameters="";
if ( is_string( $function[0] ) ) {
$object = $function[0];
} else if ( is_object( $function[0] ) ) {
$object = get_class( $function[0] );
foreach ( $function[0] as $parameter => $value ) {
// if the array is empty
if ( empty( $value ) )
$value = __( 'The Array is empty' );
$parameters .= '<li><code>' . $parameter . '</code> => <code>' . $value . '</code></li>';
}
}
if ( ! empty( $parameters ) )
$parameters="<br><strong>Parameters of class:</strong><ul>" . $parameters . '</ul>';
$function = '<code>' . $object . '::' . $function[1] . '</code>' . $parameters;
}
else {
$function = 'empty';
}
$output .= "<li$style><strong>Shortcode: </strong><code>$tag</code> <strong>Function: </strong>$function</li>";
}
$output .= '</ol>';
echo $output;
}