WordPressデフォルトだとタグが使いづらい。
カテゴリーは一覧が表示されてるけど、タグは良く使うタグとtextインプットに「追加」ボタンがあるだけだった。。。
いや前に作ったタグとか覚えてないんですけど!!!
という訳で他の方のページを参考に、カテゴリー同様タグも一覧表示するように変更!
お使いの環境に合わせたpath/wp-content/themes/お使いのテーマ/functions.phpに以下を追記!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
function re_register_post_tag_taxonomy() { global $wp_rewrite; $rewrite = array( 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag', 'with_front' => ! get_option('tag_base') || $wp_rewrite->using_index_permalinks(), 'ep_mask' => EP_TAGS, ); $labels = array( 'name' => _x( 'Tags', 'taxonomy general name' ), 'singular_name' => _x( 'Tag', 'taxonomy singular name' ), 'search_items' => __( 'Search Tags' ), 'popular_items' => __( 'Popular Tags' ), 'all_items' => __( 'All Tags' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Tag' ), 'view_item' => __( 'View Tag' ), 'update_item' => __( 'Update Tag' ), 'add_new_item' => __( 'Add New Tag' ), 'new_item_name' => __( 'New Tag Name' ), 'separate_items_with_commas' => __( 'Separate tags with commas' ), 'add_or_remove_items' => __( 'Add or remove tags' ), 'choose_from_most_used' => __( 'Choose from the most used tags' ), 'not_found' => __( 'No tags found.' ) ); register_taxonomy( 'post_tag', 'post', array( 'hierarchical' => true, 'query_var' => 'tag', 'rewrite' => $rewrite, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, '_builtin' => true, 'labels' => $labels ) ); } add_action( 'init', 're_register_post_tag_taxonomy', 1 ); |
保存!更新!出来た!
参考にしたサイト
【WordPress】投稿のタグをカテゴリーのようにする方法
ほんとググるとWordPressはすぐ出てくるから楽ですなぁ、、、(遠い目)
コメントを書く