Title: Hook
Last modified: July 11, 2021

---

# Hook

 *  Resolved [veshop](https://wordpress.org/support/users/veshop/)
 * (@veshop)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/)
 * Hi,
 * is there a hook for adding taxonomies? I want to achieve this:
 * [https://gofile.io/d/8LCCcp](https://gofile.io/d/8LCCcp)

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

 *  Plugin Contributor [wpvideogallery](https://wordpress.org/support/users/wpvideogallery/)
 * (@wpvideogallery)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/#post-14649335)
 * Our videos belong to the Custom Post Type “aiovg_videos”. So, you can simply 
   use the WordPress’ standard “register_taxonomy” [https://developer.wordpress.org/reference/functions/register_taxonomy/](https://developer.wordpress.org/reference/functions/register_taxonomy/)
   function to register new taxonomies. But, our plugin menus are added using the“
   add_submenu_page” function from WordPress for some reason. So, you should also
   use the same method to add your taxonomies as our plugin sub-menus. Kindly refer**/
   wp-content/plugins/all-in-one-video-gallery/admin/categories.php** file to see
   how our plugin taxonomies are added. This should give you an idea for adding 
   new taxonomies.
    -  This reply was modified 5 years, 1 month ago by [wpvideogallery](https://wordpress.org/support/users/wpvideogallery/).
 *  Thread Starter [veshop](https://wordpress.org/support/users/veshop/)
 * (@veshop)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/#post-14651982)
 * Hi there,
 * Thank you so far! My problem is still though: it doesn’t show up in the submenu:-/
   Could you be so kind as to check the taxonomy.php and the categories.php I adapted
   according to your advise and see what I did wrong? I would send a link to these
   through the contact form of your plugin website if that is oK.
 * Basically I used this in taxonomy.php to add four taxonomies:
 *     ```
       /**
        * Create one taxonomy, genres for the post type "aiovg_videos".
        *
        * @see register_post_type() for registering custom post types.
        */
       function wpdocs_create_aiovg_videos_taxonomies() {
           // Add new taxonomy, make it hierarchical (like categories)
           $labels = array(
               'name'              => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
               'singular_name'     => _x( 'Genre', 'taxonomy singular name', 'textdomain' ),
               'search_items'      => __( 'Search Genres', 'textdomain' ),
               'all_items'         => __( 'All Genres', 'textdomain' ),
               'parent_item'       => __( 'Parent Genre', 'textdomain' ),
               'parent_item_colon' => __( 'Parent Genre:', 'textdomain' ),
               'edit_item'         => __( 'Edit Genre', 'textdomain' ),
               'update_item'       => __( 'Update Genre', 'textdomain' ),
               'add_new_item'      => __( 'Add New Genre', 'textdomain' ),
               'new_item_name'     => __( 'New Genre Name', 'textdomain' ),
               'menu_name'         => __( 'Genre', 'textdomain' ),
           );
   
           $args = array(
               'hierarchical'      => true,
               'labels'            => $labels,
               'show_ui'           => true,
               'show_admin_column' => true,
               'query_var'         => true,
               'rewrite'           => array( 'slug' => 'genre' ),
           );
   
           register_taxonomy( 'genre', array( 'aiovg_videos' ), $args );
   
           unset( $args );
           unset( $labels ); 
   
        }
       // hook into the init action and call create_book_taxonomies when it fires
       add_action( 'init', 'wpdocs_create_book_taxonomies', 0 );
       ```
   
 * And adapted your categories.php accordingly, copying your code for categories,
   replacing it four times with my four taxonomies. Nothing shows :-/ I am a newbie
   so it would be great if you could check, Thanks so much!
 *  Thread Starter [veshop](https://wordpress.org/support/users/veshop/)
 * (@veshop)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/#post-14652101)
 * P.S.: I rand both php through a couple of php code checkers, always returned ‘
   No issues found’ and the website runs as normal, so there seems to be nothing
   wrong with the codes after I uploaded the files, my four taxonomies are just 
   not showing anywhere in the dashboard menu :-/
 *  Plugin Contributor [wpvideogallery](https://wordpress.org/support/users/wpvideogallery/)
 * (@wpvideogallery)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/#post-14653804)
 * Kindly locate the following line from your code,
 * `add_action( 'init', 'wpdocs_create_book_taxonomies', 0 );`
 * and change it as,
 * `add_action( 'init', 'wpdocs_create_book_taxonomies', 999 );`
 * Also, in addition to registering the taxonomies, you must use the “add_submenu_page”
   WordPress function to add the registered taxonomies as menu items. Kindly double-
   check my initial reply to this post. Maybe you have added the menu functions 
   but have not shared them with us here. If yes, kindly share the whole code to
   have a look.
 *  Thread Starter [veshop](https://wordpress.org/support/users/veshop/)
 * (@veshop)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/#post-14656056)
 * Hi,
 * I send you the php, then you have a better understanding about what I did (I 
   did add the “add_submenu_page” function btw 🙂

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

The topic ‘Hook’ is closed to new replies.

 * ![](https://ps.w.org/all-in-one-video-gallery/assets/icon-256x256.gif?rev=3635542)
 * [All-in-One Video Gallery – Video Player & Galleries for YouTube, Vimeo & Self-Hosted Videos](https://wordpress.org/plugins/all-in-one-video-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/all-in-one-video-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/all-in-one-video-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/all-in-one-video-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/all-in-one-video-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/all-in-one-video-gallery/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [veshop](https://wordpress.org/support/users/veshop/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/hook-13/#post-14656056)
 * Status: resolved