Commit 6e51e46c7fb for woocommerce
commit 6e51e46c7fbd5ad8d9341d770bfdafc8aed9e724
Author: Néstor Soriano <konamiman@konamiman.com>
Date: Fri Jul 31 09:10:53 2026 +0900
Update the documentation for conditional functions (#67143)
State that that conditional functions simply return false
when used before the main query is set up.
diff --git a/docs/theming/theme-development/conditional-tags.md b/docs/theming/theme-development/conditional-tags.md
index 72b62406ad1..7d09d85a5d2 100644
--- a/docs/theming/theme-development/conditional-tags.md
+++ b/docs/theming/theme-development/conditional-tags.md
@@ -12,7 +12,7 @@ The conditional tags of WooCommerce and WordPress can be used in your template f
Because WooCommerce uses custom post types, you can also use many of WordPress' conditional tags. See [codex.wordpress.org/Conditional_Tags](https://codex.wordpress.org/Conditional_Tags) for a list of the tags included with WordPress.
-**Note**: You can only use conditional query tags after the `posts_selection` [action hook](https://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request) in WordPress (the `wp` action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php.
+**Note**: You can only use conditional query tags after the `posts_selection` [action hook](https://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request) in WordPress (the `wp` action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php. If a conditional tag is used before it's supposed to, it won't trigger any error or warning: it will simply return `false`, even if the condition it checks for would be met later in the request.
## Available conditional tags
diff --git a/plugins/woocommerce/changelog/update-docs-for-conditional-functions b/plugins/woocommerce/changelog/update-docs-for-conditional-functions
new file mode 100644
index 00000000000..60baa8e0ceb
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-docs-for-conditional-functions
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Document that conditional functions simply return false when used before the main query is set up.
diff --git a/plugins/woocommerce/includes/wc-conditional-functions.php b/plugins/woocommerce/includes/wc-conditional-functions.php
index 3a5fb6bd6c7..4925b28b205 100644
--- a/plugins/woocommerce/includes/wc-conditional-functions.php
+++ b/plugins/woocommerce/includes/wc-conditional-functions.php
@@ -4,6 +4,11 @@
*
* Functions for determining the current query/page.
*
+ * Note that the query-dependent conditional functions are only reliable
+ * once the main query has been set up, that is, on or after the "wp" action hook.
+ * If used before that, they won't trigger any error or warning: they will simply
+ * return false, even if the condition they check for would be met later in the request.
+ *
* @package WooCommerce\Functions
* @version 2.3.0
*/