Title: Request: Shortcode filter (Patch Included)
Last modified: November 9, 2016

---

# Request: Shortcode filter (Patch Included)

 *  [jbeninger](https://wordpress.org/support/users/jbeninger/)
 * (@jbeninger)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/request-shortcode-filter-patch-included/)
 * I’m providing a limited set of shortcodes to a client, so I needed Shortcode 
   Reference’s functionality, but didn’t want the default WP shortcodes cluttering
   up the list.
 * I’ve added the following filter which will only include documentation for the
   shortcodes I want. Feel free to add it to the plugin code.
 *     ```
       @@ -50,7 +50,16 @@ class ShortcodeReferenceService {
                               global $shortcode_tags;
   
                               self::$references = array();
       -                       foreach($shortcode_tags as $tag => $function) {
       +                       
       +                       /**
       +                        * Filter the list of shortcodes that will appear in the Shortcode Reference metabox
       +                        * 
       +                        * @param array shortcode_tags array Shortcodes in the same format as the $shortcode_tags global (tag =
       +       */
       +                       $documented_tags = apply_filters('shortcode_reference', $shortcode_tags);
       +                       
       +                       
       +                       foreach($documented_tags as $tag => $function) {
                                       $name = $tag.'_Reflection';
                                       $$name = new ShortcodeReference($tag);
                                       self::$references[$tag] = $$name;
       ```
   
 * **Usage**
 *     ```
       add_filter('shortcode_reference', 'clientprefix_filter_shortcode_reference');
       function clientprefix_filter_shortcode_reference($shortcodes) {
         $result = [];
   
         foreach ($shortcodes as $tag => $fn) {
           if (preg_match('/^clientprefix-/', $tag)) {
             $result[$tag] = $fn;
           }
         }
   
         return $result;
       }
       ```
   
 * Thanks for this simple-yet-effective plugin!

The topic ‘Request: Shortcode filter (Patch Included)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shortcode-reference.svg)
 * [Shortcode Reference](https://wordpress.org/plugins/shortcode-reference/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcode-reference/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcode-reference/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcode-reference/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcode-reference/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcode-reference/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [jbeninger](https://wordpress.org/support/users/jbeninger/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/request-shortcode-filter-patch-included/)
 * Status: not resolved