• Using WP’s search facility, I can enter a search term that will match only one result. When this happens, the matched post appears in its full form with comments, but for some reason the POST ‘s’ variable has been cleared.
    This is a major annoyance, as I’m trying to add a title (something like ‘Search Results’) to my page if the user has performed a search. I tried if(!empty($s)) which for some reason didn’t work when only post was matched, so I inserted a debugging print_r($HTTP_POST_VARS); call, but this prints Array ( ) when only one post was matched.
    Anyone come across something like this before?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter davidhouse

    (@davidhouse)

    This is getting to be very strange. I’ve put print_r()s all over the place, but HTTP_POST_VARS always seems to be empty, even before any other php code has executed.

    Searches are usually passed through $_GET.

    Thread Starter davidhouse

    (@davidhouse)

    Okay, when I print_r HTTP_GET_VARS on a search that only revealed a single result, ‘year’, ‘month’, ‘day’ and ‘name’ are set, but not ‘s’.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Searching – $_POST[‘s’] gets cleared when t’ is closed to new replies.