我正在尝试获取自定义术语的链接。
我在中设置了所有URL的前缀的问题Permalinks
就像那样
/blog/%category%/%postname%/
所以我有以下默认条款的链接
http://example.net/blog/tag/development/
它工作得很好。
但我已经使用register_taxonomy
作用
我尝试获取分类归档url
get_term_link($term_id);
此函数以以下格式返回链接
http://example.net/my_term/test2/
这个链接工作得很好,但我需要它
http://example.net/blog/my_term/test2/
我怎样才能做到这一点?
EDIT
用于注册分类的参数
/* Set up the arguments for the my_taxonomy taxonomy. */
$args = array(
\'public\' => true,
\'show_ui\' => true,
\'show_in_nav_menus\' => true,
\'show_tagcloud\' => true,
\'show_admin_column\' => true,
\'hierarchical\' => false,
\'query_var\' => \'my_taxonomy\',
/* Only 2 caps are needed: \'manage_my_taxonomy\' and \'edit_posts\'. */
\'capabilities\' => array(
\'manage_terms\' => \'manage_my_taxonomy\',
\'edit_terms\' => \'edit_posts\',
\'delete_terms\' => \'edit_posts\',
\'assign_terms\' => \'edit_posts\',
),
/* The rewrite handles the URL structure. */
\'rewrite\' => array(
\'slug\' => \'my_taxonomy\',
\'with_front\' => false,
\'hierarchical\' => false,
\'ep_mask\' => EP_NONE
),
/* Labels used when displaying taxonomy and terms. */
\'labels\' => array(
\'name\' => __(\'My Taxonomy\', \'my_taxonomy\'),
\'singular_name\' => __(\'My Taxonomy\', \'my_taxonomy\'),
\'menu_name\' => __(\'My Taxonomy\', \'my_taxonomy\'),
\'name_admin_bar\' => __(\'My Taxonomy\', \'my_taxonomy\'),
\'search_items\' => __(\'Search my_taxonomy\', \'my_taxonomy\'),
\'popular_items\' => __(\'Popular my_taxonomy\', \'my_taxonomy\'),
\'all_items\' => __(\'All My Taxonomy\', \'my_taxonomy\'),
\'edit_item\' => __(\'Edit My Taxonomy\', \'my_taxonomy\'),
\'view_item\' => __(\'View My Taxonomy\', \'my_taxonomy\'),
\'update_item\' => __(\'Update My Taxonomy\', \'my_taxonomy\'),
\'add_new_item\' => __(\'Add New My Taxonomy\', \'my_taxonomy\'),
\'new_item_name\' => __(\'New My Taxonomy Name\', \'my_taxonomy\'),
\'separate_items_with_commas\' => __(\'Separate my_taxonomy with commas\', \'my_taxonomy\'),
\'add_or_remove_items\' => __(\'Add or remove my_taxonomy\', \'my_taxonomy\'),
\'choose_from_most_used\' => __(\'Choose from the most used my_taxonomy\', \'my_taxonomy\'),
)
);
/* Register the \'my_taxonomy\' taxonomy. */
register_taxonomy(\'my_taxonomy\', array(\'post\'), $args);