A release of quick wins: the WooCommerce query type catches up with the other query types on a few params, “Current Term” finally does what it says, and WooCommerce’s own product blocks now work inside a query loop.
New
- WooCommerce Include/Exclude products — the WooCommerce query type now has Include Products and Exclude Products params under Product Filters, matching what the Post, Terms and Users query types already offered. Both accept plain product IDs, including comma-separated lists in presets. An include list that sanitizes away to nothing returns no products rather than the whole catalogue.
- WooCommerce product blocks inside a loop item — WooCommerce’s Add to Cart + Options block (Beta in WooCommerce 11.2) now works inside a WooCommerce Query loop item, variation selectors and all. Each loop item emits the
woocommerce/productsInteractivity context WooCommerce’s blocks read, and a loop item that already carries its owndata-wp-contextkeeps it. Newgb_query_enhancements_wc_products_interactivity_contextfilter to alter or skip the context per item. - Opt-in WooCommerce store load — blocks that only read WooCommerce’s product store client-side, like Product SKU on a variable product, also need the product loaded into that store. That costs roughly 3 ms per product per page load, so it’s off by default. Turn it on with the new toggle in the WooCommerce card on the settings page, or with the
gb_query_enhancements_wc_load_products_storefilter, which has the final say per item. The load is best-effort: if a future WooCommerce release rejects the call, the item degrades to the flag-off behaviour and the failure is written to the WooCommerce logs once per request instead of taking the page down. - “Current Term” for Child of and Parent — Term queries can now use the current term as the
child_oforparentvalue even outside a term loop, so a taxonomy archive template can list the children of whatever term is being viewed. gb_query_enhancements_wc_orderby_meta_mapfilter — repoint a WooCommerceorderbyvalue likepopularityat your own precomputed meta key (say, recent sales instead of all-timetotal_sales), or add a new orderby value, without racing the plugin’s own remap. Custom values pass the orderby allow-list, a custom value that fails to map falls back todateexplicitly, and one malformed entry only drops that entry rather than the whole map. The Hooks Reference spells out the zero-fill requirement that comes with it.gb-query-enhancements.queryParametersJavaScript filter — one filter over every query type’s parameter definitions, applied with{ queryType }(plusisVariationsfor WooCommerce). Add, remove, relabel, re-default or reorder params, or extend a select’s options, for example to expose a custom sort value in the Order by dropdown.Utils::sanitize_ids()— one shared ID sanitizer for the Term, User and WooCommerce query types.
Improved
- Hooks Reference — gained a WooCommerce Query Hooks section, the
currentsentinel semantics for Term and User selectors, and the WooCommerce presetinclude/excludekeys.
Fixed
- Fatal error when a block’s
uses_contextisn’t an array — both the Term and User context filters now tolerate a nulluses_contextinstead of dying on the type hint, and still add their context. - “Current Term” in Term Include/Exclude was silently dropped — the sentinel was never resolved for
include,exclude,parentorchild_of, so picking it did nothing. It now resolves from the loop’s term context first, then from the queried term on archive pages. - Unresolvable “current” selections no longer widen a Term query —
object_ids,parentorchild_ofset to the current term/post with nothing to resolve against (for example a Term query inside a User loop) used to fall back to listing every term. They now match nothing, on every supported WordPress version. - “Current User” in User Include listed every user when logged out — an
includecontaining onlycurrentsanitized to an empty list, whichWP_User_Querytreats as no restriction. It now matches nothing.include/excludealso accept comma-separated strings, like the Term and WooCommerce types.
Deprecated
Term_Query::sanitize_term_ids()andUser_Query::sanitize_user_ids()in favour ofUtils::sanitize_ids(). Both still work and emit a deprecation notice.