Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Wordpress Creating a custom taxonomy

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 107
    Comment on it

    Welcome to Findnerd. We are using wordpress function named register_taxonomy to create a new custom taxonomy. There are many in-bulid taxonomies like categories,tags and Link categories. This functions takes three parameters. First one is name of the taxonomy. it must be in lower case letters and not more than 32 characters. second one is the object type which can be post,revision,page,attchment ,nav_menu_item and custom post type as well. Last one is the array of different elements. last parameter array includes different elements like label,public,query_vars,rewrite etc. Let's take an simple example.

    add_action( 'init', 'build_your_taxonomy' );
    function build_your_taxonomy() {
    register_taxonomy(
    'mytest',
    'post',
    array(
    'label' => 'myway',
    'hierarchical' => true,
    )
    ); 
    

    In above example we build a taxonomy for post with name mytest and passed the arguments like hierachical and label. It will create a new taxonomy for post like category.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: