Title: Adding hidden filter parameters based on url
Last modified: August 31, 2016

---

# Adding hidden filter parameters based on url

 *  Resolved [cselin](https://wordpress.org/support/users/cselin/)
 * (@cselin)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/adding-hidden-filter-parameters-based-on-url/)
 * Thanks for the great plugin.
 * I’m trying to figure out how I can use filters to append certain taxonomy filters
   to the url based on the previous page.
 * So on this site I am developing, I have one CPT with a few different taxonomies
   attached. I want to hide the ‘hireable’ taxonomy filter but have it changed in
   the background depending on which page the user uses the filtering widget from.
 * Eg the user is on taxonomy archive page for the taxonomy ‘hire’ and the term ‘
   yes’. They see the taxonomy filter widget, and it shows them options from the
   product category taxonomy and the product product age taxonomy. They do not see
   the drop down showing them the ‘ hire’ taxonomy. However, because this filtering
   widget is accessed from the hire taxonomy archive page, I append ‘hire/yes’ to
   the url.
 * Is there a way I can detect the url of the page the user is on when they submit
   the taxonomy filter form? Eg some version of
 *     ```
       function modify_new_url($url){
       //get current query taxonomy and term
       //if current taxonomy is ‘hire’ and current term is ‘yes'
           return $url . ‘hire/yes/';
   
       }
       add_filter('beautiful_filters_new_url', 'modify_new_url');
       ```
   
 * Thanks a lot for the great plugin
 * [https://wordpress.org/plugins/beautiful-taxonomy-filters/](https://wordpress.org/plugins/beautiful-taxonomy-filters/)

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

 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/adding-hidden-filter-parameters-based-on-url/#post-7119502)
 * Hi Cselin,
 * Thank you for those kind words! If you really find BTF useful a nice review goes
   a long way! 🙂
 * I’m pretty sure you should be able to use all WordPress conditionals etc in this
   hook. So you could do something like:
 *     ```
       function modify_new_url($url){
       	global $wp_query;
       	/**
       	 * Only run this on hire tax archive and the hire query var is set.
       	 * It will append whatever term is used (yes/no/blabla/duckies-are-cute)
       	 */
       	if( is_tax('hire') && isset( $wp_query->query_vars['hire'] ) ){
       		$url = $url . 'hire/' . $wp_query->query_vars['hire'] . '/';
       	}
           return $url;
   
       }
       add_filter('beautiful_filters_new_url', 'modify_new_url');
       ```
   
 *  Thread Starter [cselin](https://wordpress.org/support/users/cselin/)
 * (@cselin)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/adding-hidden-filter-parameters-based-on-url/#post-7119515)
 * Excellent, that’s so easy! 🙂 Thank you!
 *  Plugin Author [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * (@jonathandejong)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/adding-hidden-filter-parameters-based-on-url/#post-7119534)
 * No problem, glad to help!

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

The topic ‘Adding hidden filter parameters based on url’ is closed to new replies.

 * ![](https://ps.w.org/beautiful-taxonomy-filters/assets/icon-256x256.png?rev=1654967)
 * [Beautiful taxonomy filters](https://wordpress.org/plugins/beautiful-taxonomy-filters/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/beautiful-taxonomy-filters/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/)
 * [Active Topics](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/beautiful-taxonomy-filters/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Jonathan de Jong](https://wordpress.org/support/users/jonathandejong/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/adding-hidden-filter-parameters-based-on-url/#post-7119534)
 * Status: resolved