1

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.

1
  • Good answer below. Also, you can click the name of the tags/categories that are displayed near the post's title / other info on the 'All Posts' page (/wp-admin/edit.php) or, simply type the tag into the url: /wp-admin/edit.php?tag=test
    – admcfajn
    Commented Dec 29, 2017 at 21:27

1 Answer 1

1

Done 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.