I have a search box that I have designed using a view.
This then searches and loads a different page + view.
The search box on it works fine and queries the next page.
However I added a query filter to it for a shortcode input for a taxonomy. I set this in the search box view but it then does not pass this query filter to the next page that uses a different view.
Is there a way to solve this? Possibly I should be using a hidden field instead? Although I need to pass the data through a shortcode attribute so I can easily vary it per page.
I'm not sure I quite understand your setup, but I imagine a solution would go something like this:
You have a View with a custom search field on a page. A user submits a search, but the results are set to be shown on a different page. That page would have URL parameters added relating to the View filters, one of which will specify the search term.
A second View is included on that target page, and should also be filtered by that search term. Which means the second View needs a Query Filter that listens to the URL parameter containing the search term that was appended by the first View. A URL parameter, not a shortcode attribute.
A more likely scenario for using a shortcode attribute would be if your Views were nested, and you wanted to pass some value from the outer View to the inner View.
If I've got that wrong, please help me understand what exactly you are aiming for.
So you are correct in everything you have said Nigel, but I don't want to just filter by the search term.
The search term filter is working perfectly fine, page A has the search box view which then searches page B.
However on page A I want to have a hidden field basically that preselects a taxonomy as "UK". Basically page A is about the UK, so I want it to automatically filter by UK results (theres a taxonomy "country").
I wanted to use the shortcode attribute so when I use the custom search on a page I can easily set the country to UK or AU for example.
However I can't get this to work. I think I am doing something wrong.
OK, I understand what you are aiming for, but I did some testing and shortcode attributes won't help you here.
You are inserting the shortcode for the search form on page A and inserting the shortcode for the search results on page B.
It's on page A that you want to specify a term that should be used in a taxonomy filter (e.g. "uk"), but the View query isn't happening on page A, it's happening on page B, so that's where you would need to add the shortcode attribute to specify the uk term.
Because you need to pass the info to a View on another page (it is the "same" View, but a different instance of the same View) you can only do that with a URL parameter, but there is no way to add such a parameter in the scenario you describe, because displaying the results on a different page is handled by Views and the only thing you have control over is the id of the page where the results should be loaded. There's no mechanism to append a URL parameter.
I looked through the Views API to see if there were some filter I'd maybe forgotten about that could help here, but there's nothing, it's just not something that can be done in the way you describe I'm afraid.