• We’re using a child theme derived from twentyfourteen, but you can recreate this issue using the twentyfourteen theme as well, so it’s not as though our changes caused this issue.

    When you search for all pages and posts containing the word “the”, you should get several pages of results which are nicely paginated for you via the twentyfourteen_paging_nav() function call in search.php .

    Unfortunately on the first page of results the global wp_query->is_search() returns false. As soon as you page through your search results, you get is_search() returning true again, as expected

    We’ve tried hacking the global wp_query->is_search=true in search.php before and after the call to twentyfourteen_page_nav() to no avail. This is my first WordPress forum post. Hoping someone else out there has had the same problem and been able to hack their way around it.

    Thanks in advance for your anticipated patience and co-operation.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m unable to replicate your issue on my twentyfourteen installation. Perhaps it’s not your changes, but possibly another plugin? Secondary queries often alter the global query. If the secondary code does not restore the original state, you get weird behavior like you observed. Is there anything different on your first page that does not occur on subsequent pages? Not just the search template, but the sidebar, footer, anything? Or the other way around, occurs on all pages but the first?

    It also could matter where on the page you are using is_search(). Widgets in particular often have difficulty in getting proper template tag values.

    Welcome to the www.ads-software.com forums.

    I’ve run into lots of problems in my WordPress programming where the query was changed by something (a plugin, a widget, bugs in my code), as @bcworkz suggests above.

    One thing that helps a lot with this (infuriating) process is the awesome Query Monitor plugin, which gives you a lot of information about what’s going on behind the scenes in your page.

    https://www.ads-software.com/plugins/query-monitor/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pagination breaks wp_query->is_search’ is closed to new replies.