How to Exclude Headings from Your Easy Table of Contents
Content
A common challenge for users of the Easy Table of Contents plugin is preventing unwanted headings from appearing in the generated table. This often happens when other plugins or theme elements, such as related posts, author boxes, or product sliders, insert their own headings into the page content. The plugin scans the entire post content, and these external headings can be unintentionally included.
Fortunately, the plugin provides several built-in methods to exclude specific headings, giving you control over what appears in your table of contents.
Method 1: Exclude Headings by Text
The most straightforward method is to use the Exclude Headings field found in the plugin's main settings or within the meta box on individual posts and pages. You can enter headings you want to ignore, separated by a pipe | character.
You can use wildcards for more flexibility:
- Fruit*: Ignores headings starting with "Fruit"
- *Fruit Diet*: Ignores headings containing "Fruit Diet" anywhere in the text
- Apple Tree|Oranges: Ignores headings that are exactly "Apple Tree" or "Oranges"
For example, to exclude a newsletter sign-up section with the headings "Join the Journey" and "Sign up," you would enter: Join the Journey*|*Sign up*
Method 2: Exclude Headings by CSS Class or ID (Advanced)
If the headings you want to exclude are generated by another plugin or theme component, they often have a unique CSS class or ID assigned to them. The Easy Table of Contents plugin can target these selectors to exclude them.
To enable this feature:
- Navigate to the Easy TOC settings in your WordPress admin dashboard.
- Click on the Advanced tab.
- Enable the options for Exclude Headings by Class and/or Exclude Headings by ID.
- Save your changes.
Once enabled, the plugin will automatically ignore any heading that has a class or ID attribute. For instance, if a related posts plugin outputs headings with class='related-post-title', those headings will be skipped. This is a powerful way to exclude entire sections without having to list every possible heading title.
Method 3: Disable Auto-Insert for Specific Posts
If you do not want a table of contents to appear on a specific post or page at all, you can disable it individually. This is useful for excluding entire content types, like recipe posts.
- Edit the post or page where you want to remove the TOC.
- Scroll down to the Table of Contents meta box.
- Check the option to Disable the insertion of the table of contents for this page.
- Update or publish the post.
Troubleshooting Common Issues
- Exclusions Not Working with [ez-toc] Shortcode: Some users have reported that exclusion rules work with the old
[toc]shortcode but not with the newer[ez-toc]shortcode. If you encounter this, try switching shortcodes to see if it resolves the issue. - Long Exclusion Lists: The "Exclude Headings" field can accept a large number of entries, but very long lists may become difficult to manage. Using the Exclude by Class method is often a more efficient long-term solution for excluding headings from plugins.
- Dynamic Content: Content added dynamically after the page loads (e.g., via JavaScript) typically cannot be excluded, as the plugin scans the content when the page is generated on the server.
By using these exclusion methods, you can fine-tune your table of contents to display only the most relevant headings for your readers.
Related Support Threads Support
-
Reduce items?https://wordpress.org/support/topic/reduce-items/
-
Easy TOC Can’t Exclude headingshttps://wordpress.org/support/topic/easy-toc-cant-exclude-headings/
-
Hide H3 & H4s (not excluding)https://wordpress.org/support/topic/hide-h3-h4s-not-excluding/
-
Exclude Headings in Related Posts Blockhttps://wordpress.org/support/topic/exclude-headings-in-related-posts-block/
-
Want to disbale easy table of content for few postshttps://wordpress.org/support/topic/want-to-disbale-easy-table-of-content-for-few-posts/
-
Exclude relative articles in table of contexthttps://wordpress.org/support/topic/exclude-relative-articles-in-table-of-context/
-
Exclude heading inserted dynamicallyhttps://wordpress.org/support/topic/exclude-heading-inserted-dynamically/
-
TOC now including reusable block titles and the related posts pluginhttps://wordpress.org/support/topic/toc-now-including-reusable-block-titles-and-the-related-posts-plugin/
-
Can I exclude the quiz questions from appearing in my TOC?https://wordpress.org/support/topic/can-i-exclude-the-quiz-questions-from-appearing-in-my-toc/
-
how to exclude specific titles in TOC – page by page – example?https://wordpress.org/support/topic/how-to-exclude-specific-titles-in-toc-page-by-page-example/
-
Can’t exclude certain headingshttps://wordpress.org/support/topic/cant-exclude-certain-headings/
-
Table of content won’t exclude all “exclude headings”https://wordpress.org/support/topic/table-of-content-wont-exclude-all-exclude-headings/
-
Exclude enfold Related Posts shortcode from TOChttps://wordpress.org/support/topic/exclude-enfold-related-posts-shortcode-from-toc/
-
Editing TOChttps://wordpress.org/support/topic/editing-toc/
-
Select specific headings (h1, h2, etc.) in manual TOChttps://wordpress.org/support/topic/select-specific-headings-h1-h2-etc-in-manual-toc/
-
Issue with Excluding Headings in [ez-toc]https://wordpress.org/support/topic/issue-with-excluding-headings-in-ez-toc/
-
How to exclude my WP Product Review Lite fhttps://wordpress.org/support/topic/how-to-exclude-my-wp-product-review-lite-f/
-
Exclusion of titles does not workhttps://wordpress.org/support/topic/exclusion-of-titles-does-not-work/
-
How to remove multiple headershttps://wordpress.org/support/topic/how-to-remove-multiple-headers-2/
-
My Templateshttps://wordpress.org/support/topic/my-templates/
-
Bug: incorrect array iteration with excluded headingshttps://wordpress.org/support/topic/bug-incorrect-array-iteration-with-excluded-headings/
-
omit recipe fieldhttps://wordpress.org/support/topic/omit-recipe-field/
-
How to exclude some headings in TOChttps://wordpress.org/support/topic/how-to-exclude-some-headings-in-toc/
-
Author Box in table of contenthttps://wordpress.org/support/topic/author-box-in-table-of-content-2/
-
Exclude products from the table of contentshttps://wordpress.org/support/topic/exclude-products-from-the-table-of-contents/
-
Problem when used with Reviews from MyThemeShophttps://wordpress.org/support/topic/problem-when-used-with-reviews-from-mythemeshop/
-
How do I exclude posts?https://wordpress.org/support/topic/how-do-i-exclude-posts/