[resolved] is_search() not working (2 posts)

  1. RRikesh
    Posted 2 years ago #

    Hello Chouby

    I have a problem on my search results page. The function is_search() isn't being triggered. I tried other is_xxx() functions and saw that it is is_tax() that is being triggered with the language name as term - tested with the following code:

    $term = $wp_query->get_queried_object();
    $title .= $term->name;

    The url structure of the results page is:

    From the url structure, I guess it is because the language is being considered as a taxonomy that is_tax() is being triggered.

    For the time being I'm using this hack when using is_tax() to detect the results page:

    if( 'English' == $term->name || 'Fran├žais' == $term->name ){
          if( function_exists( 'pll_register_string' ) ){
            $title .= pll__( 'Results Page' );

    Is there any direct way to detect the search result using is_search() or the method mentioned above is the good way to proceed?

    Polylang Version: 0.9.3


  2. Chouby
    Plugin Author

    Posted 2 years ago #

    It's curious that I don't reproduce this problem with is_search()
    However I tried to suppress the is_tax flag on search pages (issue that I reproduced easily) in the current development version (
    Maybe this will solve your issue with is_search

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Polylang
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic