Listable – redirect category to archive page

<?php

// Add to your (child) theme's functions
function fwp_homepage_redirect() {
?>
<script>
(function($) {
    $(function() {
        // replace the submit button's "onclick" handler
        $('.search_jobs--frontpage-facetwp .search-submit').attr('onclick', 'custom_redirect()');
    });
})(jQuery);

function custom_redirect() {
    FWP.parse_facets();
    FWP.set_hash();
    var query_string = FWP.buildQueryString();
    if ('' != query_string) {
        query_string = '?' + query_string;
    }
    var pagename = '/postes/';
    if (FWP.facets.categories.length > 0) {
        pagename = '/category-listing/' + FWP.facets.categories[0];
    }

    window.location.href = pagename + query_string;
}
</script>
<?php
}
add_action( 'wp_head', 'fwp_homepage_redirect', 100 );