目前,我已创建了一个名为“”的自定义分类法genre“我想知道如何将其包含到数组中,以便使用示例中提供的字符串中的内容发布。
$my_post = array(
\'post_title\' => wp_strip_all_tags( trim( $post_title ) ),
\'post_content\' => $my_post,
\'post_status\' => \'publish\',
\'post_author\' => 2,
\'post_category\' => array( 2 ),
\'the_taxonomy\' => $v[\'artist\'][\'name\'],
\'post_date\' => date(\'Y-m-d H:i:s\')
);
下面可以看到我目前使用的自定义税收。
add_action( \'init\', \'create_genre_nonhierarchical_taxonomy\', 0 );
function create_topics_nonhierarchical_taxonomy() {
$labels = array(
\'name\' => _x( \'Genre\', \'taxonomy general name\' ),
\'singular_name\' => _x( \'Genre\', \'taxonomy singular name\' ),
\'search_items\' => __( \'Search Genre\' ),
\'popular_items\' => __( \'Popular Genre\' ),
\'all_items\' => __( \'All Genre\' ),
\'parent_item\' => null,
\'parent_item_colon\' => null,
\'edit_item\' => __( \'Edit Genre\' ),
\'update_item\' => __( \'Update Genre\' ),
\'add_new_item\' => __( \'Add New Genre\' ),
\'new_item_name\' => __( \'New Genre Name\' ),
\'separate_items_with_commas\' => __( \'Separate topics with commas\' ),
\'add_or_remove_items\' => __( \'Add or remove topics\' ),
\'choose_from_most_used\' => __( \'Choose from the most used topics\' ),
\'menu_name\' => __( \'Genre\' ),
);
register_taxonomy(\'topics\',\'post\',array(
\'hierarchical\' => false,
\'labels\' => $labels,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'update_count_callback\' => \'_update_post_term_count\',
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'topic\' ),
));
}
非常感谢您的帮助