Instead of implementing a custom search query, instead include the custom fields in the standard search, and use rewrite rules to map /?post_type=cars&s=mysearchterm
to /search/cars/mysearchterm
. Or just use the query vars in the URL rather than POST
/$_POST
or transient data. GET
/$_GET
is your friend here.
Transients are intended for storing data temporarily rather than recalculating it, e.g. RSS feeds, and other things that are expensive to calculate that may not have a permanent lifetime. They are not a replacement for sessions ( nor should you need sessions or some other analogue ).
This should show you how to bundle the custom fields in the search:
http://stv.whtly.com/2010/03/15/extend-wordpress-search-to-include-custom-post-meta/
Test against $wp->query_vars['s']
or get_query_var( 's' )
to see if your search query is for your post type so you can then conditionally include the custom meta search bits.
credits: thanks kaiser for the get_query_var tip