[wp-trac] [WordPress Trac] #62593: Condition for doing_it_wrong for conditional tags is too generic
WordPress Trac
noreply at wordpress.org
Wed Nov 27 23:59:38 UTC 2024
#62593: Condition for doing_it_wrong for conditional tags is too generic
--------------------------+-----------------------------
Reporter: kkmuffme | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The condition for doing it wrong on conditionals is too generic, causing
it to not trigger in many cases, e.g. is_search(),...
https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-
includes/query.php#L861
e.g. define WP_DEBUG true and add this to an (mu-)plugin and open a 404 or
search page and you'll see that you won't get an error from
_doing_it_wrong
{{{#!php
<?php
function test_conditionals() {
if ( is_404() ) {
wp_die( '404' );
}
if ( is_search() ) {
wp_die( 'search' );
}
}
add_action( 'setup_theme', 'test_conditionals' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62593>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list