Title: Can&#8217;t activate code
Last modified: July 8, 2022

---

# Can’t activate code

 *  [Cacique](https://wordpress.org/support/users/carlosjavier10/)
 * (@carlosjavier10)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/cant-activate-code/)
 * The code I show here works when placed in the function.php file of the theme,
   but in your plugin “code snnipet” it doesn’t let me activate it, it tells me 
   that there is an error in line 2 always (even if I put everything in a single
   line).
 * function my_hidden_filters ($filters)
    { if (!empty ($_GET[‘country’])) $filters[‘
   field_24’] = $_GET[‘country’]; return $filters; }
 * add_filter (‘bps_hidden_filters’, ‘my_hidden_filters’);
 * the development is done locally, and I’m using buddypress with the theme “Twenty
   Twenty-One”.
 * Thank you very much in advance, I hope you can tell me what is going on or if
   I’m doing something wrong! happy day
 * Translated with [http://www.DeepL.com/Translator](http://www.DeepL.com/Translator)(
   free version)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcant-activate-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/cant-activate-code/#post-15855246)
 * Can you share the error message? I can’t really say for sure what’s going wrong
   without knowing what it says.
 * Here’s a new version of the snippet that should at least fix some common mistakes:
 *     ```
       add_filter( 'bps_hidden_filters', function ( $filters ) {
       	if ( ! empty ( $_GET[ 'country' ] ) ) {
       		$filters[ 'field_24' ] = $_GET[ 'country' ];
       	}
   
       	return $filters;
       } );
       ```
   
 * Let me know if it still continues to produce an error.

Viewing 1 replies (of 1 total)

The topic ‘Can’t activate code’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/cant-activate-code/#post-15855246)
 * Status: not a support question