I am using facet search on my site. The search paths for taxonomy term facets are of the pattern "search/term-name", but I would like them to be of the pattern "search/term-tid".

Is this possible? How can I change this?


Please try this:

 * Implements hook_facetapi_searcher_info_alter().
function mymodule_facetapi_searcher_info_alter(array &$searcher_info) {
  foreach ($searcher_info as &$info) {
    $info['url processor'] = 'term_facet_url';

Create a folder inside your mymodule directory, and name it facetapi.

Next is create an .inc file and name it, url_processor_term_facet_url

So you should have this structure:


Inside of your url_processor_term_facet_url.inc, add the following code.


 * @file
 * A custom URL processor.

 * Extension of FacetapiUrlProcessor.
class FacetapiUrlProcessorTermFacetUrl extends FacetapiUrlProcessorStandard {

  public function getQueryString(array $facet, array $values, $active) {
    $params = $this->params;
    return $params;

  public function getFacetPath(array $facet, array $values, $active) {
    // Change the line below to your desired taxonomy term path, currently it
    // is set to 'taxonomy/term/[tid]'. And also make sure only taxonomy terms
    // are affected. Check other parameters to pull the data you might need.
    $path = 'taxonomy/term/' . $values[0];
    return $path;


I hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.