How to add filter by Tags in wp admin dashboard?
There are option for category and date filter but not tags filter. I want to filter wp post by tags.
Did from many forum but didn't work.
I am non-coder. pls suggest.
How to add filter by Tags in wp admin dashboard?
There are option for category and date filter but not tags filter. I want to filter wp post by tags.
Did from many forum but didn't work.
I am non-coder. pls suggest.
Share Improve this question asked Dec 29, 2017 at 4:02 SanjeevSanjeev 313 bronze badges 1 |1 Answer
Reset to default 1Done Successfully from this coding. Inserted wp-includes/function.php
function kc_add_taxonomy_filters() {
global $typenow;
// an array of all the taxonomyies you want to display. Use the taxonomy name or slug
$my_taxonomies = array( 'post_tag' );
switch($typenow){
case 'post':
foreach ($my_taxonomies as $tax_slug) {
$tax_obj = get_taxonomy($tax_slug);
$tax_name = $tax_obj->labels->name;
$terms = get_terms($tax_slug);
if(count($terms) > 0) {
echo "<select name='$tax_slug' id='$tax_slug' class='postform alignleft actions'>";
echo "<option value=''>Show All $tax_name</option>";
foreach ($terms as $term) {
echo '<option value="', $term->slug,'" ',selected( @$_GET[$tax_slug] == $term->slug , $current = true, $echo = false ) , '>' , $term->name ,' (' , $term->count ,')</option>';
}
echo "</select>";
}
}
break;
}
}
Now,Insert child theme folder/function.php
add_action( 'restrict_manage_posts', 'kc_add_taxonomy_filters' );
Thanks.
/wp-admin/edit.php?tag=test
– admcfajn Commented Dec 29, 2017 at 21:27