The actual templates are loaded with require_once
, so PHP automatically ignores the second attempt to load them. (You will trigger the ‘get_header’ hook twice though.)
Here’s the relevant code in get_header():
$templates[] = 'header.php';
if ( ! locate_template( $templates, true, true, $args ) ) {
return false;
}
The third parameter to locate_header(), the second true, is the load-with-require-once flag. There’s no filter we can use to change that behaviour here.
Note that you could include two different header templates, e.g. if you created a copy of header.php as header-duplicate.php in your theme then
get_header();
get_header('duplicate');
would include them both, as this wouldn’t get blocked by require_once.
Related Posts:
- Issues with title-tag and document_title_parts
- Import WordPress XML File from Within Functions.php
- Define custom Page Template without its own .php file
- Does hooking into the same action multiple times drain memory?
- How to influence the information displayed on widget inside wp-admin
- Is there a hook or function I can use to display all theme files being used on a current page?
- Issue with get_theme_mod returning a blank value instead of the saved value
- Add action hook conditionally – only when home.php in use
- Show modified time if post is actually modified
- why doesnt is_home() work in functions.php
- Implementing DNS Prefetching with WordPress
- Help me to understand wp_header() and wp_footer() functions
- How can I tell if I’m on a login page? [duplicate]
- In WooCommerce I need to modify the thankyou.php page [closed]
- How can I add an extra WooCommerce hook
- Remove Page Title from Static Frontpage
- How to override WordPress registration and insert an auto-generated username?
- Set default options for inserting media
- Change parent theme file function in child themes functions.php
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- How to hook into the quick edit action?
- gform_after_submission content appears immediately after , not in post body [closed]
- How do I change parameters without changing the core
- Is it possible to be more page/post specific with admin_enqueue_script?
- WooCommerce add_action hook results in 500 error
- Increment price for Woocommerce Minicart [closed]
- how to change link of some wordpress pages
- Gravity Forms field entries into wp_query loop [closed]
- Post thumbnail relative link and HTML modify
- Proper way of using functions in action hook?
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- How to properly add function called by action-hooked function to functions.php?
- Which action hook to use for function?
- Change size and crop medium_large images
- Inserting a functions output after the content
- Add function to every post?
- Modify a function without editing template
- Don’t delete a page if it holds users
- Problem only while using require_once() within functions.php
- Passing values from a widget to a function within a plugin
- How can I get my Script to work on the Login page?
- Execute a ultimate member action when user role is updated
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Replace a menu with widget or a custom template file programmatically
- Footer disappears when using the_content ( )
- Get User Login Data (date, time… )
- Registration Hooks don’t appear to be working
- jQuery does not work
- Why does re-using this function not work? [closed]
- Pass parameter to hooked function using custom page template
- Override the WordPress core function wp_referer_field
- How to return hook data when multiple parameters are present?
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- How to edit the Tags within the image file URLs?
- Is my code correct to enqueue CSS on a specific page?
- Can’t properly set the_title add_filter to show short_URL
- Control the srcset much more (not all sizes in it each time)
- How to add_filter html template to middle of content
- (Woocommerce) Order by price when entering specific category
- Auto log in hook is requiring a page refresh
- Possible to hook into Media Library preview File column and use a custom image?
- Add back in child theme what the parent theme removed with remove_action
- Writing a function to detect an event
- WordPress wraps span tags into p tags
- Changing where my author box is printed
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Add Adsense code between job listings – wp job manager plugin
- update_post_meta is Updating with two page id
- Replace admin header logo with an image
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- is_home() not working in functions.php file
- How to conditionally add a widget via a hook in functions.php
- How to place a div inside a function that creates a div
- Changing the text of Upload/Insert on Posts and Pages Screen
- Filter for replacing the WP_query object for a given category
- How to add or delete default value theme options while activate and deactivate theme
- Warning at top of website & top menu gone
- Does hook have an effect on increasing the page load?
- What is the earliest Hook a Script can use?
- Populate acf-field, depending on block name
- How Do I Unhook This Parent Theme Function?
- Calling hooks in functions
- How to add custom column into custom post, when field is select
- True email confirmation for registration (keeping unvalidated users from user table)
- How to echo the translated custom field?
- Init hook for header send
- Why wp_ajax hooks doesn’t work?
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- Why functions metaboxes is causing White Screen in Admin [closed]
- How do I add functionality to images?
- How to hook wp_mail to add a custom email as BCC for each sent email?
- image_size with respect to aspect ratios
- Get category of post inside save_post hook
- Create section wit form
- Log in and out using custom pages, no logout confirmation and redirects for logging in and out 2023
- Copy and Modified WooCommerce function is_coupon_valid [closed]