• I have a search form with 3 fields:

    search text field named “Search”
    order by drop down menu named “order”
    date picker named “date”
    and a custom WP_Query to display the search results
    and WordPress pagination function
    the search results are displayed correctly
    however when I try to go to the next page it also displays the next page results correctly but the URL doesn’t look right the URL looks like this:

    /page/2/?search=run&date#038;date
    it works fine when I comment out the date picker field
    I tried replacing the date picker with an input filed named “cat” and it works fine

    the problem comes back when I have the input field named “post_status” or “age” or “post_type” of “date” or “year”
    these are the names that I tried so far

    /page/2/?search=run&post_status#038;post_status
    How can I fix this URL problem?
    How can I have a date picker in my search from with out causing this URL problem?

Viewing 2 replies - 1 through 2 (of 2 total)
  • There are certain variables that you cannot use, because they are reserved for the query. If you are passing them directly, it’s okay to use them because that’s what they are for, but if they are in a different format and you have to change it for the query, you need to use a different variable name.

    Thread Starter zahra15

    (@zahra15)

    According to this:
    https://codex.wordpress.org/Reserved_Terms
    “date” is not a reserved word.
    an I am not passing it directly to the query but it is causing this URL issue
    I am taking the value from the date picker
    separating the month and year
    then passing it to the date_query
    is there away to directly pass the month and year form the form to the wp_query?

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

The topic ‘custom query pagination URL problem’ is closed to new replies.