Snippet: Display advanced search fields by default

With this snippet you can display all the advanced search fields by default.

Read here to find out about how to add code snippets to your site.
Heads up: You can add Custom CSS either through the Custom CSS Field which is available through the Customizer in WP-Admin > Appearance > Customize (if you’re using WordPress 4.7) or you can add this into your child theme’s style.css (if you’re using a child theme) or you can simply use a 3rd party plugin like Simple Custom CSS for example.


The search form is divided into 2 areas: standard and advanced. The advanced part only shows up if the WPCasa Advanced Search add-on is installed and active. This part can be toggled to be visible or not – by the user of your site. This state gets saved within a cookie which is left on the users computer.

With the code snippet above, you basically make the advanced search fields visible by default. So if you load your website, they show up by default and your users can toggle them to be hidden (instead of having the fields hidden by default and having the user to toggle them to be visible).

The attached CSS Snippet lets you hide the “Advanced Search” Button. So the user does not have the option anymore to display or hide the advanced search fields – regardless if they’re visible or not.

Keep in mind that if you add this code snippet, you’d first need to clean your browser cookies (specifically that cookie for your website) in order to get the cookie deleted from your computer, which contains your choice (if advanced search fields are visible or not). So right after you’ve added this snippet, clean your browsers cookies (not only the cache) and reload your page. The advanced search fields should then be straight visible.

Was this article helpful? Yes · No