Skip to content

Commit

Permalink
Fixed: tags filter redirect to 404 on home page.
Browse files Browse the repository at this point in the history
  • Loading branch information
rahularyan committed Sep 21, 2017
1 parent aea6418 commit e17bcb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions addons/free/tag.php
Expand Up @@ -61,8 +61,8 @@ public static function init() {

// List filtering.
anspress()->add_filter( 'ap_list_filters', __CLASS__, 'ap_list_filters' );
anspress()->add_action( 'ap_ajax_load_filter_tag', __CLASS__, 'load_filter_tag' );
anspress()->add_filter( 'ap_list_filter_active_tag', __CLASS__, 'filter_active_tag', 10, 2 );
anspress()->add_action( 'ap_ajax_load_filter_qtag', __CLASS__, 'load_filter_tag' );
anspress()->add_filter( 'ap_list_filter_active_qtag', __CLASS__, 'filter_active_tag', 10, 2 );
}

/**
Expand Down Expand Up @@ -628,7 +628,7 @@ public static function ap_list_filters( $filters ) {
global $wp;

if ( ! isset( $wp->query_vars['ap_tags'] ) ) {
$filters['tag'] = array(
$filters['qtag'] = array(
'title' => __( 'Tag', 'anspress-question-answer' ),
'search' => true,
'multiple' => true,
Expand Down Expand Up @@ -662,7 +662,7 @@ public static function load_filter_tag() {
* @since 4.0.0
*/
public static function filter_active_tag( $active, $filter ) {
$current_filters = ap_get_current_list_filters( 'tag' );
$current_filters = ap_get_current_list_filters( 'qtag' );

if ( ! empty( $current_filters ) ) {
$args = array(
Expand Down
4 changes: 2 additions & 2 deletions includes/taxo.php
Expand Up @@ -425,7 +425,7 @@ function ap_get_tag_filter( $search = false ) {
}

$terms = get_terms( 'question_tag', $args );
$selected = ap_get_current_list_filters( 'tag' );
$selected = ap_get_current_list_filters( 'qtag' );

if ( ! $terms ) {
return false;
Expand All @@ -434,7 +434,7 @@ function ap_get_tag_filter( $search = false ) {
$items = array();

foreach ( (array) $terms as $t ) {
$item = [ 'key' => 'tag', 'value' => (string) $t->term_id, 'label' => $t->name ];
$item = [ 'key' => 'qtag', 'value' => (string) $t->term_id, 'label' => $t->name ];
// Check if active.
if ( $selected && in_array( $t->term_id, $selected, true ) ) {
$item['active'] = true;
Expand Down

0 comments on commit e17bcb7

Please sign in to comment.