[wp-trac] [WordPress Trac] #63406: Lack of mutex for query object values like is_category and is_author can result in warnings

WordPress Trac noreply at wordpress.org
Mon May 12 08:10:43 UTC 2025


#63406: Lack of mutex for query object values like is_category and is_author can
result in warnings
--------------------------+------------------------------
 Reporter:  leedxw        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  6.8
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by smahjoob):

 Unexpected Dual Archive Context: is_author() and is_category() Both True
 in Block Theme

 While testing WordPress 6.9-alpha-58136 with the default Twenty Twenty-
 Five theme, I encountered an ambiguous behavior when accessing URLs that
 include both author_name and cat query variables—for example:
 /?author_name=admin&cat=3

 In such cases, WordPress evaluates both is_author() and is_category() as
 true, resulting in a scenario where the system simultaneously treats the
 request as both an author archive and a category archive. This dual-
 context behavior introduces a critical conflict in block themes, where
 template rendering is heavily dependent on precise conditional logic.

 Block themes like Twenty Twenty-Five use the patterns/index.php file and
 internal conditionals to decide which layout pattern to load. When
 multiple archive contexts are valid, there is no explicit priority or
 override mechanism defined, leading to unpredictable or undesired output.
 There is no warning or error to inform the developer that multiple archive
 states are being resolved concurrently, which can create confusion and
 unintended template behavior—especially when custom patterns are
 introduced.

 The global $wp_query confirms the presence of both author_name and cat
 query vars, and the body_class() function reflects this with combined
 author and category classes. From a developer’s standpoint, this lack of
 decisiveness in the query resolution process contradicts the deterministic
 model expected by block themes.

 Proposed Consideration
 To avoid ambiguity and ensure predictable rendering in block-based
 environments, WordPress core should consider one or more of the following:

 Introduce an internal priority hierarchy when multiple archive types are
 present in a request.

 Add a development warning or admin notice when multiple is_*() archive
 conditions are simultaneously true.

 Provide a new helper function or property that exposes the “primary”
 archive context for the current request.

 Without resolving this ambiguity, block themes may struggle to provide
 consistent layouts for complex URLs—especially on content-heavy or
 dynamically-filtered sites.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63406#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list