Title: exclude by URL
Last modified: December 28, 2020

---

# exclude by URL

 *  Resolved [pievedepitti](https://wordpress.org/support/users/pievedepitti/)
 * (@pievedepitti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/exclude-by-url/)
 * Hi, the Ajax Search bar is as a widget on the sidebar. I need it in all pages
   excluding the page [https://www.mercatodeivignaioli.it/negozio/](https://www.mercatodeivignaioli.it/negozio/)
   where a different search form is in use.
    I try to add negozio/ in the exclude
   by url area but doesn’t work. How to solve it? Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexclude-by-url%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Damian Góra](https://wordpress.org/support/users/damian-gora/)
 * (@damian-gora)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/exclude-by-url/#post-13843638)
 * The issest way is to hide the search conditionally via CSS. Here is PHP snippet
   you can apply.
 *     ```
       add_action( 'wp_head', function () {
         $r = $_SERVER['REQUEST_URI'];
   
         if ( ! empty( $r ) && strpos( $r, '/negozio/' ) !== false ) {
           ?>
           <style>
             .dgwt-wcas-widget {
               display: none;
             }
           </style>
           <?php
         }
       } );
       ```
   
 * You have two ways to add this code to your theme:
 * Open the `functions.php` in your Child Theme and add the code at the end
    or 
   install the Code Snippets plugin and apply this code as a snippet
 * Best
    Damian
 *  Thread Starter [pievedepitti](https://wordpress.org/support/users/pievedepitti/)
 * (@pievedepitti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/exclude-by-url/#post-13843808)
 * works perfectly, thanks.
    Because the site has a second language, I’m sure I 
   can duplicate the snippet changing the name of the page, but there is a way to
   include both pages in the same code so to avoid having two snippets doing the
   same?? that’s the ENG url [https://www.mercatodeivignaioli.it/en/shop/](https://www.mercatodeivignaioli.it/en/shop/)
 *  Thread Starter [pievedepitti](https://wordpress.org/support/users/pievedepitti/)
 * (@pievedepitti)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/exclude-by-url/#post-13843899)
 * Ok, I wrote a code. Thanks
 *  Plugin Author [Damian Góra](https://wordpress.org/support/users/damian-gora/)
 * (@damian-gora)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/exclude-by-url/#post-13843909)
 * Then use it:
 *     ```
       add_action( 'wp_head', function () {
         $r = $_SERVER['REQUEST_URI'];
   
         if ( ! empty( $r ) &&
              ( strpos( $r, '/negozio/' ) !== false || strpos( $r, '/en/shop/' ) !== false )
            ) {
           ?>
           <style>
             .dgwt-wcas-widget {
               display: none;
             }
           </style>
           <?php
         }
       } );
       ```
   

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

The topic ‘exclude by URL’ is closed to new replies.

 * ![](https://ps.w.org/ajax-search-for-woocommerce/assets/icon-256x256.png?rev=
   2883754)
 * [FiboSearch - Ajax Search for WooCommerce](https://wordpress.org/plugins/ajax-search-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-search-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-search-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-search-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-search-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-search-for-woocommerce/reviews/)

## Tags

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

 * 4 replies
 * 2 participants
 * Last reply from: [Damian Góra](https://wordpress.org/support/users/damian-gora/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/exclude-by-url/#post-13843909)
 * Status: resolved