AdvSearch with query in results using queryHook


I am using AdvSearch to perform a search in multiple TVs. It works great, but in the results, I can’t get the query terms to show up. I have tried inserting the [[+query]] (or even [[+advsearch.query]]) placeholder, but nothing shows up. I noticed that if I use the default search form, the query string does show up in the search results page. I just can’t seem to get it to show up with my own custom form that searches in my TVs.

Any assistance would be much appreciated.

1 Like

Annoyingly I think the placeholders were given a new prefix in v2 of advsearch but from what I remember this wasn’t updated in all of the chunks, though it looks like you’ve already tried adding the prefix too. Do you have a custom prefix set with &asId in your call?If not try adding this:


If no luck then you can always force the placeholder value with something like this below in your hook, but you’ll need to find a way of capturing the query and setting the input if this doesn’t work - i had a quick look in the documentation but couldn’t see that but have a look through the code:

$modx->setPlaceholder('query', $input);

Thanks for the reply lkfranklin. I tried adding &asId=`` to the call, but no luck. Not super a very experienced coder, but will see what I can do with adjusting the hook. Any other assistance would be appreciated!