Home / category / Custom taxonomies
  • How to Custom taxonomies

    no thumbnail sorry: Custom taxonomies

    Adding this PHP code to your functions.php of your wordpress theme will allow you to create custom taxonomies. By default wordpress has category, tag in this sample we have genre, actors.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_action( 'init', 'create_my_taxonomies', 0 );
    function create_my_taxonomies() {
    	register_taxonomy( 'genre', 'post', array( 'hierarchical' => false, 'label' => 'Genre', 'query_var' => true, 'rewrite' => true ) );
    	register_taxonomy( 'actors', 'post', array( 'hierarchical' => false, 'label' => 'Actors', 'query_var' => true, 'rewrite' => true ) );
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    register, query, init, register_taxonomy, add_action,