[wp-trac] [WordPress Trac] #42921: get_header('customheadername') is fetching the header.php even i have provided customheadername

WordPress Trac noreply at wordpress.org
Fri Dec 18 18:11:03 UTC 2020


#42921: get_header('customheadername') is fetching the header.php even i have
provided customheadername
-------------------------------------+------------------------------
 Reporter:  mausamrai                |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Themes                   |     Version:  4.9.1
 Severity:  normal                   |  Resolution:
 Keywords:  reporter-feedback close  |     Focuses:  template
-------------------------------------+------------------------------
Changes (by hellofromTonya):

 * keywords:  reporter-feedback => reporter-feedback close


Comment:

 Hello @mausamrai,

 Does this problem still persist for you today?

 If yes, does a template file exist for the custom header, i.e. a file
 named: `header-customheadername.php`?

 How does this work?

 WordPress will load custom header templates when the `header-{template
 name}.php` file exists; else, the default template is loaded.

 You can find more information here
 https://developer.wordpress.org/reference/functions/get_header/.

 As @ Compute notes, I too suspect the problem is due to a mismatch of the
 name passed to the function and the template's filename. I'm marking this
 ticket as a `close` `worksforme` candidate. Please don't be alarmed. We
 mark tickets for close consideration when we are unable to reproduce and
 suspect the problem is not due to WordPress core. However, when more
 information is given, we reevaluate.

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


More information about the wp-trac mailing list