Home / admin / Register taxonomy for your pages
  • How to Register taxonomy for your pages

    register-taxonomy-pages

    This is a simple snippet that will register a custom taxonomy for pages. In the sample code I register a taxonomy called things but of course you would want to register something a little more realistic. You can find out more details about registering a custom taxonomy in the codex. Just add this snippet to the functions.php of your wordpress theme and you will see the new taxonomy displayed within the wordpress admin.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_action( 'init', 'pages_tax' );
    function pages_tax() {
    	register_taxonomy(
    		'things',
    		'page',
    		array(
    			'label' => __( 'Things' ),
    			'rewrite' => array( 'slug' => 'things' ),
    			'hierarchical' => true,
    		)
    	);
    }
    

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

    register, init, register_taxonomy, add_action, __,