Skip to content

Instantly share code, notes, and snippets.

@wichaksono
Created April 11, 2018 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wichaksono/288768f66cb02c2d4a158e85d318b2fc to your computer and use it in GitHub Desktop.
Save wichaksono/288768f66cb02c2d4a158e85d318b2fc to your computer and use it in GitHub Desktop.
<?php
/**
* Registrasi Taxonomy
*/
add_action( 'init', 'onphpid_taxonomy' , 0 );
function onphpid_taxonomy() {
// registrasi category product
register_taxonomy(
'product_category',
'onphpid_products', // post-type name
array(
'label' => __( 'Product Category' ),
'rewrite' => array( 'slug' => 'product-category' ),
'hierarchical' => true, // true agar menjadi Category
)
);
// registrasi tags product
register_taxonomy(
'product_tags',
'onphpid_products', // post-type name
array(
'label' => __( 'Product Tags' ),
'rewrite' => array( 'slug' => 'product-tags' ),
'hierarchical' => false, // false agar menjadi tags
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment