How to Find All the Active Shortcodes in WordPress

Shortcodes in WordPress is something that everyone loves to use. But sometimes, you don’t actually remember how many active shortcodes are there on your website.

So here I will show you the easiest way to find all the active shortcodes on your website, and display them as a list of active shortcodes in WordPress Pages/Posts and Backend (WP Admin) area.

Sounds Interesting..?. Let’s jump into this.

Get a list of all the active shortcodes in WordPress page or post

Here I am creating a shortcode function that will display all the active shortcodes on your website. All you have to do is just follow the steps:

  1. Open your theme’s functions.php file and paste the below code at the bottom and save it.

    //  Functions to display a list of all the shortcodes
    function diwp_get_list_of_shortcodes(){
    
    	// Get the array of all the shortcodes
    	global $shortcode_tags;
    	
    	$shortcodes = $shortcode_tags;
    	
    	// sort the shortcodes with alphabetical order
    	ksort($shortcodes);
    	
    	$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', 'diwp_get_list_of_shortcodes');
    
    
  2. Here I have created a shortcode [get-shortcode-list] to display a list of all active shortcodes, Copy this shortcode and follow step 3.
  3. Create a new page and paste the shortcode in it and save it.
  4. Now You will see a list of all the active shortcodes on your WordPress website like in below image.
    find-all-active-shortcodes-in-wordpress

Get A List of All Active Shortcodes in WordPress Admin Area

If you run a WordPress website and you are the admin or the person who manages all the stuff to maintain the website, then you should know about how many active shortcodes are there on your website.

So here I am writing a code to display all the active shortcodes in your WordPress admin area. follow these steps:

  1. Copy the code given below and add it to your theme’s functions.php file.
    // Create an options page to display the list of shortcodes in WordPress
    
    function diwp_display_shortcodes_admin_page() {
    
      add_options_page('All Active Shortcodes', 'Active Shortcodes', 'manage_options', 'active-shortcodes', 'diwp_display_list_of_shortcodes');
    
    }
    
    add_action('admin_menu', 'diwp_display_shortcodes_admin_page'); 
    
    
    // function to display the list of active shortcodes in WordPress
    
    function diwp_display_list_of_shortcodes(){
    	
    	global $shortcode_tags;
    	
    	$shortcodes = $shortcode_tags;
    	
    	// sort the shortcodes with alphabetical order
    	ksort($shortcodes);
    	
    	echo "<h2>List of All Active Shortcodes in Your Website.</h2>";
    
    	echo "<ol>";
    	
    	foreach ($shortcodes as $shortcode => $value) {
    		echo '<li>['.$shortcode.']</li>';
    	}
    	
    	echo "</ol>";
    	
    }
    
    
  2. Now go back to your WordPress dashboard and click on Settings, and you will see an option Active Shortcodes.
    find-all-active-shortcodes-in-wordpress-2
  3. Click on Active Shortcodes and this will show you the complete list of all the active shortcodes in your website.
    find-all-active-shortcodes-in-wordpress-3

That’s it. You’re done.

I hope this article helps you to learn how to get a list of all the active shortcodes on your WordPress website in page or post and the WordPress admin area.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top