[Resolved] Reducing the Number of Element Headers

Home Forums Support [Resolved] Reducing the Number of Element Headers

Home Forums Support Reducing the Number of Element Headers

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #1942121

    I have reduced the number of element headers on my site from 245 (which is way too many) down to around 100 (I can’t go lower unless I want the featured images of the WPSP grids to be rectangular as per this page https://www.savacations.com/interests/) to remove a lot of excessive code and use mostly featured images at the suggestion of this forum. In doing so, I just noticed that when I set up one of the new headers for All Pages, it set up the new header on a number of pages that I do not want, for instance all of my hotel pages. See here for an example https://www.savacations.com/destinations/argentina-tours-travel/argentina-accommodations/hotel-tres-reyes/. My question is what is the best way to remove the headers for the pages that I do not want for both speed and code reduction purposes? Is it to use the exclude feature that comes with the headers or some other way? Please let me know.



    Another way to ask this questions is for speed and coding purposes, is it appropriate to have a number of pages listed under location rules for each header element, rather than having one separate element for each location?

    Customer Support

    Hi there,

    performance wise, i doubt there is any noticeable difference between a) large number of single elements vs b) a smaller number of headers with a large list of exclusion rules. I think the bigger issue is related to administrating and managing the various elements and there display rules as you add more pages.

    My personal approach is to add the following PHP Snippet to your site:

    // Generate custom taxonomy for Element Display Rules
    function element_control_custom_tax() {
            array( 'post', 'page' ),
                'label' => __( 'Element Controls' ),
                'rewrite' => array( 'slug' => 'element-controls' ),
                'hierarchical' => true,
                'show_in_rest' => true,
    add_action( 'init', 'element_control_custom_tax' );
    // Exclude custom taxonomy from wp_sitemaps
    add_filter('wp_sitemaps_taxonomies', function( $taxonomies ) {
          unset( $taxonomies['element-controls'] );
          return $taxonomies;

    This will create a new Custom Taxonomy for Pages and Posts called Element Controls.
    This will allow you to create your own Terms that you can assign to Pages and/or Posts and use those terms for your Display Rules.

    For example lets say you have:
    1. a global header element set FOR all pages.
    2. pages that you want to exclude the global header element eg, Hotels
    3. pages that have a different header element eg. Special Pages.

    You could create 2 new Element Control Taxonomy Terms:
    Special Pages

    Then in your Global Header Element Exclusions you could add Element Controls > Hotel and Element Controls > Special Pages.
    Then for your header element for special pages you can set the Header Element Location to Element Controls > Special pages.

    Now from within the Page Editor, or the Bulk Editor you can set the Element Control Terms for their specific needs.


    Thanks. I will speak with my developer about this.

    Customer Support

    You’re welcome.
    For reference this document explains how to add PHP to your site:


Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.