Title: Custom Category Shortcode
Last modified: August 22, 2016

---

# Custom Category Shortcode

 *  Resolved [IanHimself](https://wordpress.org/support/users/ianhimself/)
 * (@ianhimself)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/custom-category-shortcode/)
 * Hi,
 * I’m running in to some trouble with using custom categories in short codes.
 * Below is the code I have added to functions.php – I’m assuming that’s where the
   code on this page should be copied to: [http://wp-events-plugin.com/tutorials/using-additional-custom-taxonomies/](http://wp-events-plugin.com/tutorials/using-additional-custom-taxonomies/)
 * However when I try filter by category using e.g **[events_list custom_category
   =5]** it outputs every single event regardless of what category they have.
 * Am I doing something wrong with the code, I’ve tried following the tutorial but
   can’t get it to work.
 * Also for some reason when I create a recurring event with a custom taxonomy the
   taxonomy isn’t being saved for the individual recurrences – again have I done
   something wrong with the code to cause this?
 * As ever any advice is greatly appreciated.
 * Ian
 *     ```
       /**
        * Add custom taxonomies
        */
       function add_custom_taxonomies() {
   
         register_taxonomy('amenity', 'location', array(
   
           'hierarchical' => true,
   
           'labels' => array(
             'name' => _x( 'Amenities', 'taxonomy general name' ),
             'singular_name' => _x( 'Amenity', 'taxonomy singular name' ),
             'search_items' =>  __( 'Search Amenities' ),
             'all_items' => __( 'All Amenities' ),
             'parent_item' => __( 'Parent Amenity' ),
             'parent_item_colon' => __( 'Parent Amenity:' ),
             'edit_item' => __( 'Edit Amenity' ),
             'update_item' => __( 'Update Amenity' ),
             'add_new_item' => __( 'Add New Amenity' ),
             'new_item_name' => __( 'New Amenity Name' ),
             'menu_name' => __( 'Amenities' ),
           ),
   
           'rewrite' => array(
             'slug' => 'amenities',
             'with_front' => false,
             'hierarchical' => true
           ),
         ));
   
         register_taxonomy('group',
           array( 'event','event-recurring' ),
           array(
   
           'hierarchical' => true,
   
           'labels' => array(
             'name' => _x( 'Groups', 'taxonomy general name' ),
             'singular_name' => _x( 'Group', 'taxonomy singular name' ),
             'search_items' =>  __( 'Search Groups' ),
             'all_items' => __( 'All Groups' ),
             'parent_item' => __( 'Parent Group' ),
             'parent_item_colon' => __( 'Parent Group:' ),
             'edit_item' => __( 'Edit Group' ),
             'update_item' => __( 'Update Group' ),
             'add_new_item' => __( 'Add New Group' ),
             'new_item_name' => __( 'New Group Name' ),
             'menu_name' => __( 'Group Categories' ),
           ),
   
           'rewrite' => array(
             'slug' => 'groups',
             'with_front' => false,
             'hierarchical' => true
           ),
         ));
       }
       add_action( 'init', 'add_custom_taxonomies', 0 );
   
       function my_em_own_taxonomy_register(){
   
           register_taxonomy_for_object_type('custom_category',EM_POST_TYPE_EVENT);
   
           register_taxonomy_for_object_type('custom_category',EM_POST_TYPE_LOCATION);
   
       }
   
       add_action('init','my_em_own_taxonomy_register',100);
       ```
   
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/custom-category-shortcode/#post-5295196)
 * Hi,
 * Is your custom taxonomy appearing correctly in WordPress admin? Are you able 
   to use it without problems there (adding events to it, etc.?
 *  Thread Starter [IanHimself](https://wordpress.org/support/users/ianhimself/)
 * (@ianhimself)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/custom-category-shortcode/#post-5295197)
 * Hi, thanks for the reply,
 * Yes the custom taxonomy is appearing in the WordPress admin panel for both the
   event and event-recurring post types.
 * If I create a one off event with a custom category which for example has the 
   ID of 1 the following shortcode does not filter the events but rather lists out
   all events:
    [events_list custom_category=1]
 * If I create a recurring event with a custom category then that category is not
   being saved to the individual recurrences. Even so if the category is added manually
   to a recurrence the filtering still doesn’t work.
 * Thanks,
 * Ian
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/custom-category-shortcode/#post-5295207)
 * you might need custom search attribute for this – [http://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/](http://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/)
 * eg. [https://wordpress.org/support/topic/plugin-events-manager-searching-by-custom-taxonomy?replies=10](https://wordpress.org/support/topic/plugin-events-manager-searching-by-custom-taxonomy?replies=10)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Category Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/custom-category-shortcode/#post-5295207)
 * Status: resolved