WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding categories to search via checkboxes (2 posts)

  1. Doodlebee
    Member
    Posted 3 years ago #

    Hey all,

    I'm stuck on an issue I was hoping someone could help me with. I have a custom search form I've created, but the output of the code isn't correct, making my search results wonky. (As a side note, I'm using the Relevanssi plugin to make the search results more relevant.)

    So what I have is a regular search form, but I needed checkboxes (not a dropdown) to search multiple categories. The output - as far as getting the category ID's - is good, but the results are not because it appears that 1) the results are pulling the the name *and* the array brackets, and 2) it's encoding them.

    So, instead of http://localhost:8888/?s=Search&cat=40&cat=12 (or, alternatively, http://localhost:8888/?s=Search&cat=40,12), it's giving me this string of gunk:

    http://localhost:8888/?s=Search&cat%5B%5D=40&cat%5B%5D=12

    I know the %5B%5D items are the array brackets, and I can't figure out to how to remove them from the url string. Because when I *do* remove them manually, it works perfectly. So something is encoding those brackets, and I've been pounding my head trying to figure out what.

    This is my code. I'd really appreciate it if someone could tell me how to get this stuff *un*encoded, because without that gunk, it really does work wonderfully.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. Doodlebee
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic