How to List All Available Shortcodes in WordPress

In this article, I will explain to you how you can list out all available shortcodes in WordPress. Just we need to paste the below function to the functions.php file.

With the help of the below function, we can easily retrieve all shortcodes that are available on WordPress Site.

Open your functions.php file and paste the below function to it. and let me explain what this function will do.

This function will create a shortcode named ‘[get-shortcode-list]’ by using this shortcode you can retrieve all lists of available shortcodes, Just paste the shortcode on any page where you want to display the list of shortcodes.

//  Functions to display a list of all the shortcodes
function qlc_get_list_of_shortcodes(){
    // Get the array of all the shortcodes
    global $shortcode_tags;
    $shortcodes = $shortcode_tags;
    // sort the shortcodes with alphabetical order
    $shortcode_output = "<ul>";
    foreach ($shortcodes as $shortcode => $value) {
        $shortcode_output = $shortcode_output.'<li>['.$shortcode.']</li>';
    $shortcode_output = $shortcode_output. "</ul>";
    return $shortcode_output;
add_shortcode('get-shortcode-list', 'qlc_get_list_of_shortcodes');

Leave a Reply