我正在尝试将自定义分类法(标记)添加到WordPress的默认帖子类型。因为我也想对自定义帖子类型使用这种分类法。
// Register Custom Taxonomy
function tag_synchro() {
$labels = array(
\'name\' => _x( \'QA Tags\', \'Taxonomy General Name\', ET_DOMAIN ),
\'singular_name\' => _x( \'QA Tag\', \'Taxonomy Singular Name\', ET_DOMAIN ),
\'menu_name\' => __( \'QA Tags\', ET_DOMAIN ),
\'all_items\' => __( \'All Tags\', ET_DOMAIN ),
\'parent_item\' => __( \'Parent Item\', ET_DOMAIN ),
\'parent_item_colon\' => __( \'Parent Item:\', ET_DOMAIN ),
\'new_item_name\' => __( \'New Tags Name\', ET_DOMAIN ),
\'add_new_item\' => __( \'Add New tag\', ET_DOMAIN ),
\'edit_item\' => __( \'Edit tag\', ET_DOMAIN ),
\'update_item\' => __( \'Update tag\', ET_DOMAIN ),
\'separate_items_with_commas\' => __( \'Separate tags with commas\', ET_DOMAIN ),
\'search_items\' => __( \'Search Items\', ET_DOMAIN ),
\'add_or_remove_items\' => __( \'Add or remove items\', ET_DOMAIN ),
\'choose_from_most_used\' => __( \'Choose from the most used tagd\', ET_DOMAIN ),
\'not_found\' => __( \'Not Found\', ET_DOMAIN ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'show_in_nav_menus\' => true,
\'show_tagcloud\' => true,
\'update_count_callback\' => \'_update_post_term_count\',
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => ae_get_option(\'tag_slug\', \'qa-tag\') ),
);
register_taxonomy( \'qa_tag\', array( \'post\' ), $args );
}
// Hook into the \'init\' action
add_action( \'init\', \'tag_synchro\', 0 );
我使用了上面的代码,但它似乎不起作用。我有什么办法能完成这项工作吗。提前谢谢你