[wp-trac] [WordPress Trac] #55023: get_header() notice: Theme without header.php is deprecated

WordPress Trac noreply at wordpress.org
Sat Mar 19 13:50:47 UTC 2022

#55023: get_header() notice: Theme without header.php is deprecated
 Reporter:  kpdaa         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.9.3
Component:  Themes        |     Version:  5.9
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  multisite

Comment (by ipapproval):

 Hope this isn't too 'off topic'..

 We use {{{add_action('get_header', 'function');}}}   in our ip-
 approval.php file, to trigger the plugin to run **before** a page or post
 is loaded. Because {{{get_header();}}} is not called our plugin fails to

 Being that the header is currently required, our plugin should work fine
 will any Theme. This change will break our plugin's functionality.

 Technically we can use  {{{add_action('get_head', 'function');}}}
 however loading the plugin **before** the page/post starts to load would
 be preferred.

 That said, if we do not use one of the two above **add_action**'s, to
 trigger our plugin on a page/post, and just try to use   {{{is_page()}}}
 is_page does not work.   {{{is_page()}}} will be false (or at least not
 true) even though it is a page.

 For reference, at the bottom of our ip-approval.php file, we have the
 following code (non-explanatory code omitted);

 /*  Add IP Approval IP Checker to page/post
 add_action('wp_header', 'ip_checker_action');
 function ip_checker_action(){
     if (is_page()){
         // if it is a page, do page stuff
     else {
         // else it is a post, do post stuff

 /*  Add IP Approval IP Checker to login
 add_filter('login_init', 'ip_login_action');
 function ip_login_action() {
     // triggered only on the login page

Ticket URL: <https://core.trac.wordpress.org/ticket/55023#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list