Title: Cat + Tag Filter
Author: ajayver
Published: <strong>February 14, 2011</strong>
Last modified: November 23, 2012

---

Search plugins

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://s.w.org/plugins/geopattern-icon/cat-tag-filter-widget.svg)

# Cat + Tag Filter

 By [ajayver](https://profiles.wordpress.org/ajayver/)

[Download](https://downloads.wordpress.org/plugin/cat-tag-filter-widget.0.9.1.zip)

 * [Details](https://en-au.wordpress.org/plugins/cat-tag-filter-widget/#description)
 * [Reviews](https://en-au.wordpress.org/plugins/cat-tag-filter-widget/#reviews)
 *  [Installation](https://en-au.wordpress.org/plugins/cat-tag-filter-widget/#installation)
 * [Development](https://en-au.wordpress.org/plugins/cat-tag-filter-widget/#developers)

 [Support](https://wordpress.org/support/plugin/cat-tag-filter-widget/)

## Description

If you were searching for an easy way to let your WordPress site visitors to filter
your content by a category and several tags in the same time, this plugin will help
you a lot. It will add a widget to your widgets admin page, where you can edit the
settings and put it in any “widgetized” place on your website.

This plugin will be very useful for websites with hundreds of categories and tags.
I wrote it for my travel blog where we have categories for places that we’d been
and tags for topics like video, photo, useful, mountains, beaches e.t.c.
 So I wanted
to give my visitors an ability to easily filter content by any category plus tag,
like **category India + tag Video + tag Mountains**. WordPress has the ability to
show such pages, we just need to pass the proper address to it.

If your WordPress template doesn’t support widgets, please see the `Installation`
tab, there are some instructions on how to manually add this widget in your template
files.

## Screenshots

[⌊This is how the plugin looks in twentyten, almost no styling.⌉⌊This is how the
plugin looks in twentyten, almost no styling.⌉[

This is how the plugin looks in twentyten, almost no styling.

[⌊This is how it looks on my blog⌉⌊This is how it looks on my blog⌉[

This is how it looks on my blog

[⌊These are the widget options⌉⌊These are the widget options⌉[

These are the widget options

## Installation

 1. Go to your WordPress admin dashboard -> Plugins -> Add new, then search for **Cat
    + Tag Fliter** and agree to install it.
 2. Go to youк widget options and change the widgets settings.
 3. Sometimes it is needed to manually flush rewrite rules. Go to your Permalinks Options
    and change it to something else, save, and then change it back to normal.

If it didn’t work, try this:

 1. Upload `cat-tag-filter` folder to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. Go to your widgets settings and add Cat + Tag Filter widget to your sidebar.

If your theme doesn’t support widgets, you can use this code:

    ```
    <?php the_widget('cat_tag_filter', $instance, $args); ?>
    ```

Here is a full list of default $instance arguments: ‘title’ => ‘Filter’ ‘button_title’
=> ‘Show posts’ ‘cat_list_label’ => ‘Show posts from:’ ‘tag_list_label’ => ‘With
tag:’ ‘all_cats_text’ => ‘Any category’ ‘all_tags_text’ => ‘Any tag’ ‘cats_count’
=> 1 ‘tags_count’ => 0 ‘tag_logic’ => 1 // 1 for AND and 0 for OR logic operator‘
tag_type’ => 1 // 1 for checkboxes and 0 for dropdown ‘clude_tags’ => ‘exclude’ //
can be ‘include’ or ‘exclude’ ‘exclude_tags’ => ” //used for including tags also,
if clude_tags is set to ‘include’ ‘clude_cats’ => ‘exclude’ //can be ‘include’ or‘
exclude’ ‘exclude_cats’ => ” //used for including categories also, if clude_cats
is set to ‘include’ ‘tag_tax’ => ‘post_tag’, ‘category_tax’ => ‘category’

If you want to override some settings, for example get rid of title and turn on 
the counter for tag list use this code:

    ```
    <?php the_widget('cat_tag_filter','title=&tags_count=1'); ?>
    ```

If you want to get rid of div’s that WordPress creates before and after all the 
widgets, use this code:

    ```
    <?php the_widget('cat_tag_filter','title=','before_widget=&after_widget='); ?>
    ```

You can also override `before_title` and `after_title` the same way.

## FAQ

None.

## Reviews

![](https://secure.gravatar.com/avatar/85d5f217db25da429777fb9f4a25edc5fd58d5f124328b40c92719b4165a1b8e?
s=60&d=retro&r=g)

### 󠀁[Great plugin, PHP8.3 fix attached](https://wordpress.org/support/topic/great-plugin-php8-3-fix-attached/)󠁿

 [loginwith2](https://profiles.wordpress.org/loginwith2/) February 9, 2026

Such a wonderfull plugin. Very like it. Thanks @ajayver and hope you are fine.Here
is an updated code with PHP8.3 fix. Use on your own risk. Removed the links here
for comment approval, but keep them on your file – its the creditsReplace the code
of cat-tag-filter.php with the following code: <?php/*Plugin Name: Cat + Tag FilterPlugin
URI: wordpress dot org/extend/plugins/cat-tag-filter-widget/Description: This plugin
adds a widget to your WordPress site that allows your visitors to filter posts by
category and tag.Author: Ajay VermaVersion: 0.9.1Author URI: ajayver dot com/*//*
Copyright 2011 Verma Ajay (email : ajayverma1986@gmail dot com)*/if (isset($_POST["
ctf_submit"]) && $_POST["ctf_submit"] == 1) { //if submit button was pressedrequire('../../../
wp-load.php' ); //require wordpress core functions$cat = ''; //initialize variables
for category and tag parts of the url$tag = '';$tag_prefix = $_POST["tag_prefix"].'/';//
get tag and category prefix$cat_prefix = $_POST["cat_prefix"] .'/';if ($_POST["tag_logic"]
== 1) $tag_logic = '+'; //logic for tags (AND or OR)else $tag_logic = ',';if ($_POST["
cat"] != -1) { //if a category was chosen$_POST['cat'] = get_term($_POST['cat'],
$_POST['category_tax']); //get category slug from it's id$cat = '/'. $cat_prefix.
$_POST['cat']->slug; //add it to category part of the url$tag_prefix = '/' . $_POST["
tag_prefix"] . '/'; //add & to tag part of url}if ($_POST["tag"] && $_POST["tag"][
0] != -1) { //if any tags were chosen$tag .= $tag_prefix; //add tag prefix to tag
part of url$i = 0;foreach ($_POST["tag"] as $tags){if ($i > 0) $tag .= $tag_logic;//
add all tags with ',' or '+' between them depends on logic$tag .= $tags;$i++;}}if(
$cat == '' && $tag == '' && $_POST["blog_url"] != '') $url = $_POST["home_url"] .'/'.
$_POST["blog_url"]; //if no category or no tag was chosen, just create a link to
blogelse $url = $_POST["home_url"]. '/' . $cat . $tag; //else, create a link to 
blog + category and tag argumentsheader('Location: ' . $url); //redirect user to
the created urlexit;}else {if (basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__))
exit('Please do not load this page directly');}function current_tax() { //determine
current tag and categoryglobal $wp_query, $ctf_options, $current_tax;$queries = 
$wp_query->tax_query->queries;if(!empty($queries)){foreach ($queries as $query) {
if ($query['taxonomy'] == $ctf_options['tag_tax']) $current_tax['tags'] = $query['
terms'];else if ($query['taxonomy'] == $ctf_options['category_tax']) $current_tax['
cats'] = $query['terms'];}if(!empty($current_tax['cats'])){foreach ($current_tax['
cats'] as $current_cat => $value) {$cat_id = get_term_by('slug', $value, $ctf_options['
category_tax']);$current_tax['cats'][$current_cat] = $cat_id->term_id;}}return $
current_tax;}}function cat_options(){ //get categories dropdown listglobal $ctf_options,
$categories, $current_tax;$args = array('show_option_none' => $ctf_options['all_cats_text'],'
taxonomy' => $ctf_options['category_tax'],'show_count' => $ctf_options['cats_count'],'
pad_counts' => 1,'hierarchical' => 1,'selected' => $current_tax['cats'][0],$ctf_options['
clude_cats'] => $ctf_options['exclude_cats'],'orderby' => 'name');wp_dropdown_categories(
$args);}function tag_options($type){ //get tagsglobal $ctf_options, $current_tax;
$there_are_tags = true;$args = array();if(!empty($current_tax['cats'][0]) && $ctf_options['
corresponding_tags'] == 1){$cat_args = array('cat' => $current_tax['cats'][0],'posts_per_page'
=> -1);query_posts($cat_args);if(have_posts()): while (have_posts()) : the_post();
$all_tag_objects = get_the_terms($post->ID, $ctf_options['tag_tax']);if($all_tag_objects){
foreach($all_tag_objects as $tag) {if($tag->count > 0) $all_tag_ids[] = $tag->term_id;
echo '<!–' . $tag->term_id . '–>';}}endwhile;endif;wp_reset_query();if (isset($all_tag_ids)){
$tags = array_unique($all_tag_ids);$include = '';if ($ctf_options['exclude_tags']!
= ''){$ctf_options['exclude_tags'] = str_replace(" ", "", $ctf_options['exclude_tags']);
$exclude = explode(',', $ctf_options['exclude_tags']);if ($ctf_options['clude_tags']
== 'include') {foreach ($tags as $tag){if (in_array($tag, $exclude)) $include .=
$tag . ',';}}else if ($ctf_options['clude_tags'] == 'exclude') {foreach ($tags as
$tag){if (!in_array($tag, $exclude)) $include .= $tag . ',';}}if ($include == '')
$there_are_tags = false;}else {foreach ($tags as $tag){$include .= $tag . ',';}}
$include = substr($include, 0, -1);$args['include'] = $include;}else $there_are_tags
= false;}else {$args[$ctf_options['clude_tags']] = $ctf_options['exclude_tags'];}
if ($there_are_tags) $tags = get_terms($ctf_options['tag_tax'],$args);$options ='';
if ($type == 1){if ($there_are_tags){$options .= '<ul>';foreach ($tags as $tag) {
$options .= '<li>';$options .= '<input type="checkbox" name="';$options .= "tag[]";
$options .= '" value="' . $tag->slug . '"';if (is_array($current_tax['tags'])) {
if (in_array($tag->slug, $current_tax['tags'])) $options .= ' checked ';}$options.
= '>';$options .= $tag->name;if ($ctf_options['tags_count'] == 1) $options .= ' ('.
$tag->count . ')';$options .= '</li>';}$options .= '</ul>';}else $options .= '<ul
><li><input type="checkbox" name="tag[]" value="-1" disabled>' . __('No tags here','
cat-tag-filter') . '</li></ul>';}else {if ($there_are_tags){$options .= '<select
name="' . "tag[]" . '" id="ctf-tag-select" ><option value="-1">';if ($ctf_options['
all_tags_text'] != '') $options .= $ctf_options['all_tags_text'];else $options .
=__('Any tag', 'cat-tag-filter');$options .= '</option>';foreach ($tags as $tag){
$options .= '<option value="' . $tag->slug . '"';if (is_array($current_tax['tags'])){
if (in_array($tag->slug, $current_tax['tags'])) $options .= ' selected="selected"';}
$options .= '>';$options .= $tag->name;if ($ctf_options['tags_count'] == 1) $options.
= ' (' . $tag->count . ')';$options .= '</option>';}$options .= '</select>';}else
$options .= '<select name="tag[]" id="ctf-tag-select" disabled ><option value="-
1">' . __('No tags here', 'cat-tag-filter') . '</option></select>';}return $options;}
function ctf_widget(){global $ctf_options;current_tax();?><form action="<?php echo
get_bloginfo('wpurl') . '/' . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__)).'/
cat-tag-filter.php'; ?>" method="post"><div id="ctf-category-selector" <?php if (
$ctf_options['cat_list_hide']) echo 'style="display:none;"'; ?> ><?php if ($ctf_options['
cat_list_label']) echo '<label for="ctf-cat-select">' . $ctf_options['cat_list_label'].'
</label>'; ?><?php cat_options(); ?></div><div id="ctf-tag-selector"><?php if ($
ctf_options['tag_list_label']) echo '<label for="ctf-tag-select">' . $ctf_options['
tag_list_label'] . '</label>'; ?><?php echo tag_options($ctf_options['tag_type']);?
></div><input type="hidden" name="ctf_submit" value="1" /><input type="hidden" name
="home_url" value="<?php bloginfo('url'); ?>" /><input type="hidden" name="blog_url"
value="<?php $blog_url = get_option( 'page_for_posts'); if ($blog_url != 0) echo
get_page_uri($blog_url); ?>" /><input type="hidden" name="tag_logic" value="<?php
echo $ctf_options['tag_logic'] ?>" /><?php $taxonomies=get_taxonomies('','','');?
><input type="hidden" name="tag_prefix" value="<?php echo $taxonomies[$ctf_options['
tag_tax']]->rewrite['slug'] ?>" /><input type="hidden" name="category_tax" value
="<?php echo $ctf_options['category_tax'] ?>" /><input type="hidden" name="cat_prefix"
value="<?php echo $taxonomies[$ctf_options['category_tax']]->rewrite['slug'] ?>"/
><input id="ctf-submit" class="button" type="submit" value="<?php echo $ctf_options['
button_title']; ?>"/></form><?php}/*** Cat + Tag Filter Class*/class cat_tag_filter
extends WP_Widget {/** constructor */function __construct() {$widget_ops = array('
classname' => 'cat-tag-filter', 'description' => __('Filter posts by category and
tag', 'cat_tag_filter') );parent::__construct(false, $name = 'Cat + Tag Filter',
$widget_ops);}static function install() {flush_rewrite_rules();}/** @see WP_Widget::
widget */function widget($args, $instance) {$defaults = array( 'title' => __('Filter','
cat-tag-filter'), 'button_title' => __('Show posts', 'cat-tag-filter'), 'cat_list_hide'
=> false, 'cat_list_label' => __('Show posts from:', 'cat-tag-filter'), 'tag_list_label'
=> __('With tag:', 'cat-tag-filter'), 'all_cats_text' => __('Any category', 'cat-
tag-filter'), 'all_tags_text' => __('Any tag', 'cat-tag-filter'), 'corresponding_tags'
=> '1', 'cats_count' => 1, 'tags_count' => 0, 'tag_logic' => 1, 'tag_type' => 0,'
exclude_tags' => '', 'exclude_cats' => '', 'clude_tags' => 'exclude', 'clude_cats'
=> 'exclude', 'tag_tax' => 'post_tag', 'category_tax' => 'category');$instance =
wp_parse_args( (array) $instance, $defaults );extract( $args );global $ctf_options;
$ctf_options['title'] = apply_filters('widget_title', $instance['title']);$ctf_options['
button_title'] = apply_filters('widget_title', $instance['button_title']);$ctf_options['
cat_list_hide'] = $instance['cat_list_hide'];$ctf_options['cat_list_label'] = apply_filters('
widget_title', $instance['cat_list_label']);$ctf_options['tag_list_label'] = apply_filters('
widget_title', $instance['tag_list_label']);$ctf_options['all_cats_text'] = apply_filters('
widget_title', $instance['all_cats_text']);$ctf_options['all_tags_text'] = apply_filters('
widget_title', $instance['all_tags_text']);$ctf_options['cats_count'] = $instance['
cats_count'];$ctf_options['corresponding_tags'] = $instance['corresponding_tags'];
$ctf_options['tags_count'] = $instance['tags_count'];$ctf_options['tag_logic'] =
$instance['tag_logic'];$ctf_options['tag_type'] = $instance['tag_type'];$ctf_options['
exclude_tags'] = $instance['exclude_tags'];$ctf_options['clude_tags'] = $instance['
clude_tags'];$ctf_options['exclude_cats'] = $instance['exclude_cats'];$ctf_options['
clude_cats'] = $instance['clude_cats'];$ctf_options['category_tax'] = $instance['
category_tax'];$ctf_options['tag_tax'] = $instance['tag_tax'];echo $before_widget;
if ( $ctf_options['title'] ) echo $before_title . $ctf_options['title'] . $after_title;
ctf_widget();echo $after_widget;}/** @see WP_Widget::update */function update($new_instance,
$old_instance) {$instance = $old_instance;$instance['title'] = strip_tags($new_instance['
title']);$instance['button_title'] = strip_tags($new_instance['button_title']);$
instance['cat_list_hide'] = $new_instance['cat_list_hide'];$instance['cat_list_label']
= strip_tags($new_instance['cat_list_label']);$instance['tag_list_label'] = strip_tags(
$new_instance['tag_list_label']);$instance['all_cats_text'] = strip_tags($new_instance['
all_cats_text']);$instance['all_tags_text'] = strip_tags($new_instance['all_tags_text']);
$instance['cats_count'] = $new_instance['cats_count'];$instance['corresponding_tags']
= $new_instance['corresponding_tags'];$instance['tags_count'] = $new_instance['tags_count'];
$instance['tag_logic'] = $new_instance['tag_logic'];$instance['tag_type'] = $new_instance['
tag_type'];$instance['exclude_tags'] = $new_instance['exclude_tags'];$instance['
exclude_cats'] = $new_instance['exclude_cats'];$instance['clude_tags'] = $new_instance['
clude_tags'];$instance['clude_cats'] = $new_instance['clude_cats'];$instance['category_tax']
= $new_instance['category_tax'];$instance['tag_tax'] = $new_instance['tag_tax'];
flush_rewrite_rules();return $instance;}/** @see WP_Widget::form */function form(
$instance) {$defaults = array( 'title' => __('Filter', 'cat-tag-filter'), 'button_title'
=> __('Show posts', 'cat-tag-filter'), 'cat_list_hide' => false, 'cat_list_label'
=> __('Show posts from:', 'cat-tag-filter'), 'tag_list_label' => __('With tag:','
cat-tag-filter'), 'all_cats_text' => __('Any category', 'cat-tag-filter'), 'all_tags_text'
=> __('Any tag', 'cat-tag-filter'), 'corresponding_tags' => '1', 'cats_count' =>
1, 'tags_count' => 0, 'tag_logic' => 1, 'tag_type' => 0, 'exclude_tags' => '', '
exclude_cats' => '', 'clude_tags' => 'exclude', 'clude_cats' => 'exclude', 'tag_tax'
=> 'post_tag', 'category_tax' => 'category' );$instance = wp_parse_args( (array)
$instance, $defaults );?><p><strong>Please consider donating 10 cents if you like
this plugin! :)</strong> </p><p><a href="goo dot gl/SCdKg"><img src="paypalobjects
dot com/en_US/i/btn/btn_donateCC_LG.gif" alt="donate" /></a></p><p><label for="ctf-
widget-title"><?php _e('Widget title', 'cat-tag-filter'); ?>:</label><input type
="text" id="ctf-widget-title" name="<?php echo $this->get_field_name('title'); ?
>" value="<?php echo esc_attr($instance['title']);?>" /></p><p><input type="checkbox"
id="ctf-cat-list-hide" name="<?php echo $this->get_field_name('cat_list_hide'); ?
>" value="true" <?php if ($instance['cat_list_hide'] == true) echo "checked ";?>/
><label for="ctf-cat-list-hide"><?php _e('Hide categories dropdown', 'cat-tag-filter');?
></label></p><p><label for="ctf-cat-list-title"><?php _e('Categories dropdown label','
cat-tag-filter'); ?>:</label><input type="text" id="ctf-cat-list-title" name="<?
php echo $this->get_field_name('cat_list_label'); ?>" value="<?php echo esc_attr(
$instance['cat_list_label']);?>" /></p><p><label for="ctf-all-cats-text"><?php _e('
All categories option text', 'cat-tag-filter'); ?>:</label><input type="text" id
="ctf-all-cats-text" name="<?php echo $this->get_field_name('all_cats_text'); ?>"
value="<?php echo esc_attr($instance['all_cats_text']);?>" /></p><p><input type="
checkbox" id="ctf-cats-count" name="<?php echo $this->get_field_name('cats_count');?
>" value="1" <?php if ($instance['cats_count'] == 1) echo "checked ";?>/><label 
for="ctf-cats-count"><?php _e('Show categories post count', 'cat-tag-filter'); ?
></label></p><p><label for="ctf-exclude_cats"><?php _e('Coma separated category 
id\'s to ', 'cat-tag-filter'); ?><select name="<?php echo $this->get_field_name('
clude_cats'); ?>" id="ctf-clude-cats" ><option value="exclude" <?php if ($instance['
clude_cats'] == 'exclude') echo 'selected="selected" ';?> ><?php _e('exclude', '
cat-tag-filter'); ?></option><option value="include" <?php if ($instance['clude_cats']
== 'include') echo 'selected="selected" ';?> ><?php _e('include', 'cat-tag-filter');?
></option></select>:</label><input type="text" id="ctf-exclude_cats" name="<?php
echo $this->get_field_name('exclude_cats'); ?>" value="<?php echo esc_attr($instance['
exclude_cats']);?>" /></p><p><label for="ctf-tag-list-title"><?php _e('Tags dropdown
label', 'cat-tag-filter'); ?>:</label><input type="text" id="ctf-tag-list-title"
name="<?php echo $this->get_field_name('tag_list_label'); ?>" value="<?php echo 
esc_attr($instance['tag_list_label'])?>" /></p><p><label for="ctf-all-tags-text"
><?php _e('All tags option text', 'cat-tag-filter'); ?>:</label><input type="text"
id="ctf-all-tags-text" name="<?php echo $this->get_field_name('all_tags_text'); ?
>" value="<?php echo esc_attr($instance['all_tags_text']);?>" /></p><p><label for
="ctf-tag-type"><?php _e('How to show tags:', 'cat-tag-filter'); ?></label><select
name="<?php echo $this->get_field_name('tag_type'); ?>" id="ctf-tag-type" ><option
value="0" <?php if ($instance['tag_type'] == 0) echo 'selected="selected" ';?> >
<?php _e('Dropdown list', 'cat-tag-filter'); ?></option><option value="1" <?php 
if ($instance['tag_type'] == 1) echo 'selected="selected" ';?> ><?php _e('Checkboxes','
cat-tag-filter'); ?></option></select></p><p><label for="ctf-tag-logic"><?php _e('
Logic operator for multiple tags:', 'cat-tag-filter'); ?></label><select name="<?
php echo $this->get_field_name('tag_logic'); ?>" id="ctf-tag-logic" ><option value
="0" <?php if ($instance['tag_logic'] == 0) echo 'selected="selected" ';?> ><?php
_e('OR', 'cat-tag-filter'); ?></option><option value="1" <?php if ($instance['tag_logic']
== 1) echo 'selected="selected" ';?> ><?php _e('AND', 'cat-tag-filter'); ?></option
></select></p><p><input type="checkbox" id="ctf-tags-count" name="<?php echo $this-
>get_field_name('tags_count'); ?>" value="1" <?php if ($instance['tags_count'] =
= 1) echo "checked ";?>/><label for="ctf-tags-count"><?php _e('Show tags post count','
cat-tag-filter'); ?></label></p><p><input type="checkbox" id="ctf-corresponding-
tags" name="<?php echo $this->get_field_name('corresponding_tags'); ?>" value="1"
<?php if ($instance['corresponding_tags'] == 1) echo "checked ";?>/><label for="
ctf-corresponding-tags"><?php _e('Show only corresponding tags for current category','
cat-tag-filter'); ?></label></p><p><label for="ctf-exclude_tags"><?php _e('Coma 
separated tag id\'s to ', 'cat-tag-filter'); ?><select name="<?php echo $this->get_field_name('
clude_tags'); ?>" id="ctf-clude-tags" ><option value="exclude" <?php if ($instance['
clude_tags'] == 'exclude') echo 'selected="selected" ';?> ><?php _e('exclude', '
cat-tag-filter'); ?></option><option value="include" <?php if ($instance['clude_tags']
== 'include') echo 'selected="selected" ';?> ><?php _e('include', 'cat-tag-filter');?
></option></select>:</label><input type="text" id="ctf-exclude_tags" name="<?php
echo $this->get_field_name('exclude_tags'); ?>" value="<?php echo esc_attr($instance['
exclude_tags']);?>" /></p><p><label for="ctf-tag-tax"><?php _e('Custom taxonomy 
name for tags', 'cat-tag-filter'); ?>:</label><input type="text" id="ctf-tag-tax"
name="<?php echo $this->get_field_name('tag_tax'); ?>" value="<?php echo esc_attr(
$instance['tag_tax']);?>" /></p><p><label for="ctf-category-tax"><?php _e('Custom
taxonomy name for categories', 'cat-tag-filter'); ?>:</label><input type="text" 
id="ctf-category-tax" name="<?php echo $this->get_field_name('category_tax'); ?>"
value="<?php echo esc_attr($instance['category_tax']);?>" /></p><ul><?php _e('List
of registered taxonomies', 'cat-tag-filter'); ?>:<?php$taxonomies=get_taxonomies('','
names');foreach ($taxonomies as $taxonomy ) {echo '<li>'. $taxonomy. '</li>';}?>
</ul><p><label for="ctf-button-title"><?php _e('Button title', 'cat-tag-filter');?
>:</label><input type="text" id="ctf-button-title" name="<?php echo $this->get_field_name('
button_title'); ?>" value="<?php echo esc_attr($instance['button_title']);?>" />
</p><?php}} // class Cat + Tag Filter// register Cat + Tag Filter widgetif (function_exists('
load_plugin_textdomain')){load_plugin_textdomain('cat-tag-filter', '/' .PLUGINDIR.'/'.
dirname(plugin_basename(__FILE__)) . '/languages/' );}add_action('widgets_init',
function() { return register_widget("cat_tag_filter"); });function add_rewrite_rules(){
global $wp_rewrite;$ctf_options = get_option('widget_cat_tag_filter');foreach ($
ctf_options as $widget_options){if ($widget_options['category_tax']){$taxonomies
= get_taxonomies('','','');$new_rules = array($taxonomies[$widget_options['category_tax']]-
>rewrite['slug'] . '/(.+?)/' . $taxonomies[$widget_options['tag_tax']]->rewrite['
slug'] . '/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?' . $taxonomies[$widget_options['
category_tax']]->query_var . '=' . $wp_rewrite->preg_index(1) . '&' . $taxonomies[
$widget_options['tag_tax']]->query_var . '=' . $wp_rewrite->preg_index(2) . '&paged
=' . $wp_rewrite->preg_index(3),$taxonomies[$widget_options['category_tax']]->rewrite['
slug'] . '/(.+?)/' . $taxonomies[$widget_options['tag_tax']]->rewrite['slug'] . '/(.
+?)/?$' => 'index.php?' . $taxonomies[$widget_options['category_tax']]->query_var.'
=' . $wp_rewrite->preg_index(1) . '&' . $taxonomies[$widget_options['tag_tax']]-
>query_var . '=' . $wp_rewrite->preg_index(2));$wp_rewrite->rules = $new_rules +
$wp_rewrite->rules;}}}add_action( 'generate_rewrite_rules', 'add_rewrite_rules' );
register_activation_hook( 'cat-tag-filter-widget/cat-tag-filter.php', array('cat_tag_filter','
install') );?>

![](https://secure.gravatar.com/avatar/d106334ac3c210d4693d47c8353aa1ac9968835650b9e0424ba5d6ee89ca3c09?
s=60&d=retro&r=g)

### 󠀁[Keeps on ticking](https://wordpress.org/support/topic/keeps-on-ticking-2/)󠁿

 [photoburt](https://profiles.wordpress.org/photoburt/) March 14, 2023

<p>Doesn't work on php8</p>

![](https://secure.gravatar.com/avatar/714c797f1fda92401fa5e6b7aa3a6304884c0cf55bf3ad0c0ecceba915809bb9?
s=60&d=retro&r=g)

### 󠀁[Works fine!](https://wordpress.org/support/topic/works-fine-1383/)󠁿

 [paulus244](https://profiles.wordpress.org/paulus244/) January 13, 2022

still working with current WP version

 [ Read all 9 reviews ](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/)

## Contributors & Developers

“Cat + Tag Filter” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ ajayver ](https://profiles.wordpress.org/ajayver/)

[Translate “Cat + Tag Filter” into your language.](https://translate.wordpress.org/projects/wp-plugins/cat-tag-filter-widget)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/cat-tag-filter-widget/),
check out the [SVN repository](https://plugins.svn.wordpress.org/cat-tag-filter-widget/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/cat-tag-filter-widget/)
by [RSS](https://plugins.trac.wordpress.org/log/cat-tag-filter-widget/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 0.9.1

 * fixed 404 on pages

#### 0.9

 * Added permalinks support. If it doesn’t work – flush rewrite rules!

#### 0.8.4

 * Added an option to switch off corresponding tags mode.
 * fixed layout in categories with no corresponding tags.
 * fixed corresponding tags for categories with more than one page of posts.

#### 0.8.4

 * fixed layout in categories with no corresponding tags.

#### 0.8.3

 * fixed a bug with tags including\excluding.

#### 0.8

 * Widget shows only corresponding tags for a chosen category.
 * It is now possible to include categories and tags instead of excluding
 * Added some comments to the code
 * Added option for hiding category dropdown list

#### 0.6

 * Added custom taxonomies support (beta).

#### 0.5

 * Added static front page support.

#### 0.4

 * Added options to exclude tags or categories

#### 0.3.3

 * Fixed bug when no tags chosen

#### 0.3

 * New option added: “Show tags as checkboxes”. Now users can choose several tags.
 * Added the donation button in widgets options. Please consider donating! Thank
   you!

#### 0.2.2

 * Plugin’s widget now retains the selected category and tag.

#### 0.2.1

 * Fixed the output of all tags in the page source code. Please update ASAP, because
   this bug was inserting a big amount of text in your page source code – very bad
   for your website indexing by search engines.

#### 0.2

 * Fixed the “no valid header” error during plugin installation.

#### 0.1

 * Plugins first publication

## Meta

 *  Version **0.9.1**
 *  Last updated **14 years ago**
 *  Active installations **100+**
 *  WordPress Version ** 2.8 or higher **
 *  Tested up to **3.4.2**
 *  Language
 * [English (US)](https://wordpress.org/plugins/cat-tag-filter-widget/)
 * Tags
 * [categories](https://en-au.wordpress.org/plugins/tags/categories/)[filter](https://en-au.wordpress.org/plugins/tags/filter/)
   [tags](https://en-au.wordpress.org/plugins/tags/tags/)[widget](https://en-au.wordpress.org/plugins/tags/widget/)
 *  [Advanced View](https://en-au.wordpress.org/plugins/cat-tag-filter-widget/advanced/)

## Ratings

 4.2 out of 5 stars.

 *  [  8 5-star reviews     ](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/?filter=2)
 *  [  2 1-star reviews     ](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/cat-tag-filter-widget/reviews/)

## Contributors

 *   [ ajayver ](https://profiles.wordpress.org/ajayver/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/cat-tag-filter-widget/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](http://goo.gl/SCdKg)