• Hello, does anybody know if there is a way that you can search posts that have multiple tags with a form using checkboxes?

    For example, I have a form that has two checkboxes for two tags Dogs and cats. When I submit I need it to display all of the posts that have the tags dogs and cats. Is this the best way to do that?

    Thanks in advance!

Viewing 4 replies - 16 through 19 (of 19 total)
  • I’m such an idiot, the search supports the post method, so it should be valid to switch to using post and use an array for the tags…

    Be back after a bit of testing…

    I’m not certain this is possible unfortunately, if you want a string in the URL then you need to use the get method on the form, and i don’t think checkboxes are gonna work for querying in the ?s=term&tag=one+two+three format…

    The reason querying directly ?s=term&tag=one+two works is because tag is a public query var that supports + seperated values for querying multiple tags, checkboxes can’t request tags in that manner from a form request using the GET method.. (and you’ll not have that URL string using POST).

    You need an array for querying multiple tags from a form, only the POST method supports this, as far as i’m aware… in using the POST method you do not have a query string like you would when using GET (default WP search form method).. so in short i don’t think what you ask is possible…

    Sorry i couldn’t help more.. though feel free to ask any questions you like, i’m still here.. ??

    Thread Starter Sryde Digital Marketing

    (@graphixworks)

    hmmm, any other thoughts as to how I can do this? Basically what I’m trying to do is have rental properties be created in posts that will have either tags or categories assigned to each post. Then I want to make it possible for people to search those posts given the certain tags (like a tag on a post would say that the property is furnished).

    Can you think of another way that someone could search property listings using tags at all?

    Thanks for all of your help ??

    Hello GraphixWorks,
    were you able to make your search with multiple tags using checkboxes work?

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Searching posts with different tags’ is closed to new replies.