1

I have searched codex wordpress and google to get all shortcodes available in the wordpress application. However, I didn’t find any useful solution.

Can anyone suggest me approach to get all available shortcodes in the wordpress application by calling a single shortcode?

Many thanks!

5

Create a new page in Wordpress theme and use below code :

<?php
        global $shortcode_tags;
        echo '<pre>'; 
        print_r($shortcode_tags); 
        echo '</pre>';
?>

For details see link and another post may helps!

For specific to your requirements use below code in functions.php then use shortcode [all_shortcodes] in your page or sidebar to list shortcodes:

add_shortcode('all_shortcodes', 'all_shortcodes_display');

function all_shortcodes_display() {

  // The available shortcodes are stored in the global variable $shortcode_tags, so we need access to it
  global $shortcode_tags;

  // let's sort the list alphabetically
  $available_shortcodes = $shortcode_tags;
  ksort( $available_shortcodes );

  // show an unordered list of available shortcodes
  echo '<ul>';
  foreach ( $available_shortcodes as $key => $value ) {
    echo '<li>' . $key . '</li>';
  }
  echo '</ul>';
}

Thanks!

  • 1
    Great see edited answer to create small short code to list all your shortcodes and please accept answer (tick) if it helped you so that answer can help others as well ! meta.stackexchange.com/questions/5234/… – jas Jan 2 '18 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.