Add Custom Header Images


Remove default header images and load custom header images from ‘The Headers’ page. Allows for easy selection of random header images in your theme.

A plugin that should be able to remove default headers for a theme and add custom headers based upon the article written by Julio Biason who was inspired by

Create a Page named The Headers. Then upload header images (media files) to the the page. The page may have a visibility of private. All images displayed on the page will be parsed, those attached to the page and those added via image blocks.

Once the custom header images are loaded, just go to Appearance > Header or Customize > Header Image and select Randomize suggested headers.

The plugin will display an error notice if there is not a page titled, The Headers.


Thanks to Andrijana Nikolic at Web Hosting Geeks for translation help.


  1. Create a new page. It can be private. It must be titled The Headers. Add any images that you want to use as custom header images to this page. Header images should be cropped appropriately for the base theme.
  2. Upload add-custom-header-images directory to the /wp-content/plugins/ directory
  3. 通过WordPress的“插件”菜单激活插件
  4. Go to Appearance > Header or Customize > Header Image and select Randomize from the Default Images section.


I have zero code experience. I spent probably 6-10 hours over several days trying to figure out how to reduce the height of my header (i.e., make it slimmer, but keep width the same) using CSS code. I had absolutely zero interest in messing with the theme editor because I've had my fair share of scares where I've almost crashed my site. Despite all of the supposed solutions out there, nothing was working. I even tried the Elementor plugins, and those didn't work either. Then this one finally worked. Best part, once again, is that you can *change the height* of your header to make it slimmer if you want. So now my pages don't have the large rectangular header image anymore. Only downside is I can't customize based on the page. I originally wanted to keep the home page the same but make all other pages' header slimmer, but this plugin will change the header on all pages. But I have to give it 5 stars because, as I said, it's the only thing that's worked for me. Nothing else has been able to make my header image slimmer. Thanks again,
2016年9月3日 4 回复
I am using Add Custom Header Images with the WordPress Twenty Eleven theme. It works great except that there seems to be a bug. The Twenty Eleven theme comes with a number of default header images that show up along with the images I had uploaded to the "The Headers" page for the plugin to use. I did a hack to fix this using a tip from Voodoo Press: // REMOVE SOME DEFAULT HEADERS function voodoo_header_out() { unregister_default_headers( array( 'wheel', 'shore', 'trolley') ); } add_action( 'after_setup_theme', 'voodoo_header_out', 11 ); If you do this, be aware that the array of default images in the example is incomplete. You will have to add the rest of them.


“Add Custom Header Images” 是开源软件。 以下人员对此插件做出了贡献。


“Add Custom Header Images”插件已被翻译至1种本地话语言。 感谢所有译者为本插件所做的贡献。

将“Add Custom Header Images”翻译成您的语言。





2.2.0 / 2023-01-13

  • update GitHub Actions
  • update to add alt text to header image

2.1.0 / 2021-07-07

  • add @10up GitHub Actions for SVN

2.0.3 / 2020-08-01

  • add check for PHP warning

2.0.2 / 2020-03-28

  • initialize some variables

2.0.1 / 2020-03-03

  • add header image support to theme if none exists
  • parse images from page blocks
  • refactor class methods


  • always load after_theme_setup filter


  • correctly initialize load_plugin_textdomain()


  • simplify admin notice
  • WPCS compliant
  • fixed to use wp_get_attachment_url(), thanks @poulh


  • use WP_Query instead of get_children()
  • only load after_theme_setup hook on front end


  • update Tested to
  • simplify conditional


  • don’t run from constructor
  • requires PHP 5.3, sorta


  • use class variables to hold title and page data to reduce number of calls to database


  • set after_theme_setup hook to use later priority to ensure $_wp_default_headers is set, fixes removal of default images


  • removed specific srcset code as it was unnecessary and caused failures. srcset needs to be set correctly in header.php


  • fixed malformed closing strong tag in error message


  • escape translations of page name


  • added srcset for responsive image sizes
  • tested and updated for WP 4.4.0


  • tested to 4.3


  • load textdomain early so translations work.


  • fix readme.txt as plugin name generic
  • simplify warning, remove nested if statements
  • update .pot


  • better i18n strings, updated POT


  • move remove_default_header_images to run only if The Headers page is present. Should fix a PHP Notice too.


  • remove deactivate_plugins to and just display an error notice for better compatibility.


  • added some error checking


  • more graceful exit and return


  • exit after deactivating plugin when not able to be activated


  • Add .pot files
  • Fix short description by removing Markdown


  • Initial commit to WordPress repository