Skip to content

Instantly share code, notes, and snippets.

@Anna-Myzukina
Created August 22, 2018 08:13
Show Gist options
  • Save Anna-Myzukina/370a17ef8ba9b270b3c5bae66cc91282 to your computer and use it in GitHub Desktop.
Save Anna-Myzukina/370a17ef8ba9b270b3c5bae66cc91282 to your computer and use it in GitHub Desktop.
add-posttype
<?php
/**
* Plugin Name: Add taxonomy post type
* Description: Easy add new taxonomy to your post type
* Plugin URL: http://#
* Author: Musykuna Ann
* Author http://#
* Version: 1.0
*/
function create_taxonomy_to_cars() {
register_post_type( 'car',
array(
'labels' => array(
'name' => __( 'Cars' ),
'singular_name' => __( 'Car' )
),
'menu_position' => 5,
'supports' => array('title','editor','post-formats','except','thumbnail'),
'public' => true,
'has_archive' => true,
)
);
register_taxonomy(
'moduls',
'car',
array(
'label' => __( 'Moduls' ),
'rewrite' => array( 'slug' => 'person' ),
)
);
}
add_action( 'init', 'create_taxonomy_to_cars' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment