How to add Backend Category Filter in Custom Post Type WordPress

Share on facebook
Share on twitter
Share on linkedin

As a default WordPress don’t have a Backend Category Filter in each Custom Post Type.

In this tutorial i will teach you how to add a Backend Category Filter from your Custom Post Type.

Please copy and code below and paste it from your child theme functions.php

add_action('restrict_manage_posts', 'ac_filter_post_type_by_taxonomy');
function ac_filter_post_type_by_taxonomy() {
	global $typenow;
	$post_type = 'deal'; // change to your post type
	$taxonomy  = 'deal_category'; // change to your taxonomy
	if ($typenow == $post_type) {
		$selected      = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
		$info_taxonomy = get_taxonomy($taxonomy);
			'show_option_all' => __("Show All {$info_taxonomy->label}"),
			'taxonomy'        => $taxonomy,
			'name'            => $taxonomy,
			'orderby'         => 'name',
			'selected'        => $selected,
			'show_count'      => true,
			'hide_empty'      => true,

add_filter('parse_query', 'ac_convert_id_to_term_in_query');
function ac_convert_id_to_term_in_query($query) {
	global $pagenow;
	$post_type = 'deal'; // change to your post type
	$taxonomy  = 'deal_category'; // change to your taxonomy
	$q_vars    = &$query->query_vars;
	if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
		$term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
		$q_vars[$taxonomy] = $term->slug;

If you liked this article, then please subscribe to our YouTube Channel for more WordPress video tutorials.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

You want to Learn WordPress?

Be automatically notified of all new posts. No spam. No annoying marketing emails.

How to



(Step by Step)

How to

start a


(Step by Step)

WordPress Help for Beginners

Please join our Facebook group to connect WordPress experts.