| |

How to add FacetWP Reset Filters button

If you want to add a button to reset your FacetWP filters, you may use the snippet below:

Reset FacetWP Facets

Reset all facets:


Or reset one facet:


Or reset multiple facets:

FWP.reset(['make', 'model', 'year']);

Or reset individual values:

FWP.reset({ 'make': 'audi' });

Use onclick for buttons and other HTML elements:

<button value="Reset" onclick="FWP.reset()" class="facet-reset">Reset</button>

Don’t know where to write this code? check this FacetWP tutorial

Style your Facet Reset button

    font-size: 18px;
    font-weight: 500;
    padding: 4px 10px;
    line-height: 1.7em!important;
    background-color: #00b8bc; // add your own color code here
    color: #fff;
    border: 2px solid #00b8bc; // add your own color code here
    border-radius: 3px;
    -webkit-transition: all .2s;
    transition: all .2s;
    cursor: pointer;
    color: #333;
    background-color: 009fa3; // add your own color code her

Show Reset button only when facets are selected

Code placement: see the "Javascript" section on https://facetwp.com/how-to-use-hooks/

This assumes that your reset button looks like this:
<button value="Reset" onclick="FWP.reset()" class="facet-reset">Reset</button>
(function($) {
    $(document).on('facetwp-loaded', function() {
        var query-string = FWP.build_query_string();
        if ( '' === query-string ) { // no facets are selected
        else {

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


  1. Thanks for this code, I used it successfully on my site!
    It doesn’t hide the button though, probably because I put the code in my `functions.php` instead of adding a code snippet plugin.

    Although I don’t mind this at all (it looks fine the way I’ve designed it), how can I get it to work?

  2. This code worked for me:
    (function($) {
    $(document).on(‘facetwp-loaded’, function() {
    var query_string = FWP.buildQueryString();
    if ( ” === query_string ) { // no facets are selected
    else {