I’m working on creating an advanced search tool that would allow users to search within multiple taxonomies.
For example, if the first tax is Year, and the second tax is Method. The user could get results only from the year 2012 and the method of case study.
I’ve found a few resources but haven’t had luck yet with applying them. Here’s my first resource:
I have 2 questions from this:
- Would this apply or can re recommend something similar?
- Would this script or something similar affect existing rewrite rules in the Roots Theme?
To add, I’m not looking at this.
The URLs aren’t great looking but it looks like there’s a lot of functionality there.
The rewrites in Roots (which were recently moved to a free plugin) have only ever been used for asset relocation. The internal routing of
WP_Rewrite wasn’t ever affected by it, so you shouldn’t run into any issues in that respect.
I would also look into
add_permastruct instead of adding individual rewrite rules as your link suggested. It better handles paging and endpoints, which could be important if your searches become complex.
I used that exact article as a guide for prettying up URLs for some custom queries with a Roots based theme and did not have any troubles.
Roots rewrite rules are for assets and do not affect permalinks so they should not interfere with any of your custom rewrite rules.
What you may have to manually add (if you want support for it) is making your new pretty URLs root relative. If this is of interest to you then take a look at
lib/relative-urls.php for some guidance.
Btw, have you ever tried FacetWP? I’ve been meaning to give this a shot as I often need advanced search capabilities
Good luck with the new tool. Would love to play around with it if you release it publicly.
edit: just realized @Foxaii beat me to it while I was typing this up. I got distracted pulling the FacetWP link out :).
Either way, I hope I helped a bit