[wp-trac] [WordPress Trac] #12563: New action on body open

WordPress Trac noreply at wordpress.org
Wed Sep 12 21:00:51 UTC 2018


#12563: New action on body open
---------------------------+--------------------------
 Reporter:  joostdevalk    |       Owner:  joostdevalk
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  5.0
Component:  Bundled Theme  |     Version:  3.1
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:  template
---------------------------+--------------------------

Comment (by westonruter):

 Or better, we could trigger that `_doing_it_wrong()` '''only if''' there
 is a plugin that adds an action for `wp_body_open`:

 {{{#!php
 <?php
 add_action( 'wp_footer', function() {
     if ( has_action( 'wp_body_open' ) && ! did_action( 'wp_body_open' ) )
 {
         _doing_it_wrong( 'wp_body_open', __( 'Theme template is
 wp_body_open() call after <body>' ), '4.9.9' );
     }
 } );
 }}}

 (I'm using closures for example expediency.)

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


More information about the wp-trac mailing list