I have multiple stage process that integrates complex faceting into WP queries. Problem is – the deeper I get the more fuzzy I become on how it is supposed to work and I could use a guideline rather than being inventive (and digging myself a hole).
General stages I have (pseudo-code, but close to real):
- retrieve value from URL (something simple like
person=1
) - process value and append custom query instructions (
$relationship_query[] = array('relationship' => 'person_to_cat', 'object' => 1 );
) - retrieve final custom query instructions and generate appropriate SQL directives
By now I have a lot of such going on (relationships, taxonomies, dates) and it’s becoming fragile (one corner of code doesn’t put value where other corner of code expects it to find and everything comes apart).
So large question is – what is proper protocol to pass, receive, store and process custom data to WP via URL?
Smaller parts:
- how to ensure I don’t collide with WP internals?
- where and how I store intermediary data?
- difference between
query
andquery_vars
properties? They seem to be used almost same in code, yet they tend to hold different values and methods favorquery_vars
one.
- difference between