[wp-trac] [WordPress Trac] #46743: A way to detect whether the current theme supports wp_body_open()

WordPress Trac noreply at wordpress.org
Sat Mar 28 07:40:14 UTC 2020


#46743: A way to detect whether the current theme supports wp_body_open()
--------------------------------------+----------------------
 Reporter:  SergeyBiryukov            |       Owner:  (none)
     Type:  defect (bug)              |      Status:  closed
 Priority:  high                      |   Milestone:
Component:  Themes                    |     Version:  5.2
 Severity:  normal                    |  Resolution:  wontfix
 Keywords:  has-patch needs-dev-note  |     Focuses:
--------------------------------------+----------------------

Comment (by danieliser):

 Seems a simpler solution may have eluded us.

 {{{#!php
 <?php
 add_action( 'wp_body_open', 'my_function' );
 add_action( 'wp_footer', 'my_function' );

 function my_function () {
     if ( doing_action( 'wp_body_open' ) ) {
         remove_action ( 'wp_footer', 'my_function' );
     }

     // do stuff.
 }
 }}}

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


More information about the wp-trac mailing list