Title: Problem using filters
Last modified: August 21, 2016

---

# Problem using filters

 *  Resolved [tdebaillon](https://wordpress.org/support/users/tdebaillon/)
 * (@tdebaillon)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/problem-using-filters/)
 * I use the plugin as a widget in my sidebar, and have put the following code in
   my functions.php file, in order to filter the posts displayed according to the
   language chosen
 *     ```
       add_filter( 'gtc_atts_filter', 'gtc_language_filter' );
       function gtc_language_filter( $atts ) {
       	if ( !$atts )
       		return false;
       	if (ICL_LANGUAGE_CODE == 'en') {
       		$my_filter_cat = '3';
       	} else {
       		$my_filter_cat = '92';
       	}
       	$atts['catlimit'] = $my_filter_cat;
       	return $atts;
       }
       ```
   
 * This code doesn’t work anymore. As I am a bit lousy about updates, I couldn’t
   say if this began to happen after updating WP (3.8 used) or the plugin (1.4.8).
 * Thanks in advance for your help.
 * [http://wordpress.org/plugins/google-analytics-top-posts-widget/](http://wordpress.org/plugins/google-analytics-top-posts-widget/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/problem-using-filters/#post-4455153)
 * Just tested with:
 *     ```
       add_filter( 'gtc_atts_filter', 'gtc_language_filter' );
       function gtc_language_filter( $atts ) {
         if ( !$atts )
           return false;
   
         $atts['catlimit'] = '24';
         return $atts;
       }
       ```
   
 * and it is working as expected. Only thing I can say is maybe remove the `return
   false` section in case you don’t have any other attributes.
 *  Thread Starter [tdebaillon](https://wordpress.org/support/users/tdebaillon/)
 * (@tdebaillon)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/problem-using-filters/#post-4455177)
 * Thanks for your answer.
    As the filter code works as expected, I guess the problem
   lies elsewhere, typically in WPML, which maintains ICL_LANGUAGE_CODE in its API.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem using filters’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-analytics-top-posts-widget.
   svg)
 * [Google Analytics Top Content Widget](https://wordpress.org/plugins/google-analytics-top-posts-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-analytics-top-posts-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-top-posts-widget/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)

 * 2 replies
 * 2 participants
 * Last reply from: [tdebaillon](https://wordpress.org/support/users/tdebaillon/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/problem-using-filters/#post-4455177)
 * Status: resolved