Enter your keyword

Blog

How to Custom Filter Dropdown list in Wordpress admin

 function restrict_category() {
		global $typenow;
		$post_type = 'articles'; // change HERE
		$taxonomy = 'article_category'; // change HERE
		if ($typenow == $post_type) {
			$selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
			$info_taxonomy = get_taxonomy($taxonomy);
			wp_dropdown_categories(array(
				'show_option_all' => __("Show All {$info_taxonomy->label}"),
				'taxonomy' => $taxonomy,
				'name' => $taxonomy,
				'orderby' => 'name',
				'selected' => $selected,
				'show_count' => true,
				'hide_empty' => true,
			));
		};
	}

	add_action('restrict_manage_posts', 'restrict_category');

No Comments

Add your review

Your email address will not be published.

* Feilds are Required.