这就是你抵制分类学的原因。这将添加作者作为分类法
<?php
/**
* @uses Register Book Author Taxonomy
* @uses Adds query vars
* @author Nirpendra Patel
* @return void
**/
function reg_tax_author() {
$authors = array(
\'name\' => _x( \'Authors\', \'Taxonomy plural name\', \'b_thebookstore\' ),
\'singular_name\' => _x( \'Author\', \'Taxonomy singular name\', \'b_thebookstore\' ),
\'search_items\' => __( \'Search Authors\', \'b_thebookstore\' ),
\'popular_items\' => __( \'Popular Authors\', \'b_thebookstore\' ),
\'all_items\' => __( \'All Authors\', \'b_thebookstore\' ),
\'parent_item\' => __( \'Parent Author\', \'b_thebookstore\' ),
\'parent_item_colon\' => __( \'Parent Author:\', \'b_thebookstore\' ),
\'edit_item\' => __( \'Edit Author\', \'b_thebookstore\' ),
\'update_item\' => __( \'Update Author\', \'b_thebookstore\' ),
\'add_new_item\' => __( \'Add New Author\', \'b_thebookstore\' ),
\'new_item_name\' => __( \'New Author Name\', \'b_thebookstore\' ),
\'add_or_remove_items\' => __( \'Add or remove Authors\', \'b_thebookstore\' ),
\'choose_from_most_used\' => __( \'Choose from most used Authors\', \'b_thebookstore\' ),
\'menu_name\' => __( \'Authors\', \'b_thebookstore\' ),
);
$args = array(
\'labels\' => $authors,
\'public\' => true,
\'show_in_nav_menus\' => true,
\'show_admin_column\' => true,
\'hierarchical\' => true,
\'show_tagcloud\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'query_var\' => true,
\'capabilities\' => array(),
);
register_taxonomy( \'author\', array( \'post\' ), $args );
}
add_action( \'init\', \'reg_tax_author\' );
?>
在这里
register_taxonomy( \'author\', array( \'post\' ), $args );
将“post”更改为任何自定义的post类型,或者让它保持原样,以便在post上使用分类法。这就是注册它所需的全部内容。将所有内容都放在函数中。php