WordPress: Automatically create media buttons for shortcodes

Shortcodes are pretty cool way of formatting content as well as doing a lot of other things. However, common users can often have problems when they have to remember and type the shortcodes to achieve the desired results. Even if you are a pro at WordPress, you can still forget some shortcode exists in your WordPress theme. It would have been easy if all shortcodes were available for selection in a dropdown media button in the text editor.

Add the following code snippet to the functions.php file of your wordpress theme to add a select menu with a list of all available shortcodes. You do not have to add shortcodes in the code; the snippet does it automatically. You can exclude certain shortcodes (maybe, a back-end arrangement not required by users) by adding that in the exclusion list $exclude array. You can find the details in the comment in the code.

function add_sc_select(){
    global $shortcode_tags;
     /* ------------------------------------- */
     /* enter names of shortcode to exclude bellow */
     /* ------------------------------------- */
    $exclude = array("wp_caption", "embed");
    echo '&nbsp;<select id="sc_select"><option>Shortcode</option>';
    foreach ($shortcode_tags as $key => $val){
            $shortcodes_list .= '<option value="['.$key.'][/'.$key.']">'.$key.'</option>';
     echo $shortcodes_list;
     echo '</select>';
add_action('admin_head', 'button_js');
function button_js() {
        echo '<script type="text/javascript">
           jQuery("#sc_select").change(function() {
                          send_to_editor(jQuery("#sc_select :selected").val());
                          return false;

Source: WP Snipp