Table of Contents
WB Member Wiki automatically generates a Table of Contents (TOC) for wiki pages that have three or more headings. The TOC appears inline in the page content, above the first heading, giving readers a quick overview and easy navigation to any section.
How It Works
Section titled “How It Works”The TOC is generated automatically - no shortcode or markup is needed. When you save a wiki page:
- The plugin scans the page content for
<h2>,<h3>, and<h4>headings - If three or more headings are found, a TOC box is inserted before the first heading
- Each heading becomes a numbered link in the TOC
- Headings receive
idattributes matching the link anchors (e.g.,#the-sun,#inner-planets)
If a page has fewer than three headings, no TOC is generated.
TOC Structure
Section titled “TOC Structure”The TOC box shows:
- A “Contents” label at the top
- A [hide] / [show] toggle that collapses or expands the TOC
- A numbered list of all headings, in document order
Nested headings (H3 inside H2, etc.) are displayed as a flat numbered list, not a nested tree.
Writing Pages with Good TOC Structure
Section titled “Writing Pages with Good TOC Structure”Use heading levels to organize longer pages:
## Overview ← H2## Installation ← H2### Requirements ← H3### Steps ← H3## Configuration ← H2## Troubleshooting ← H2Best practices:
- Use H2 (
##) for main sections - Use H3 (
###) for sub-sections within H2 - Avoid skipping heading levels (don’t jump from H2 to H4)
- Keep heading text concise - it becomes the TOC anchor link text
- Write headings as complete phrases, not single words
Hiding the TOC
Section titled “Hiding the TOC”Readers can click [hide] on any page to collapse the TOC. The preference is not remembered between pages.
There is currently no per-page option to disable the TOC from within the editor. To suppress the TOC site-wide or on specific pages, use the developer filter below.
Frequently Asked Questions
Section titled “Frequently Asked Questions”My page has 4 headings but no TOC appears. Why?
Check that the headings are actual <h2>, <h3>, or <h4> HTML elements - not bold text or paragraphs styled to look like headings. In the TinyMCE editor, use the Paragraph dropdown to select “Heading 2”, “Heading 3”, or “Heading 4”.
Can I change the minimum number of headings required to show the TOC? No. The threshold is fixed at three headings and is not configurable through a setting or filter. Pages with fewer than three headings never render a TOC.
How do I disable the TOC entirely?
// Disable TOC on all wiki pagesadd_filter( 'wbmw_toc_html', '__return_empty_string' );
// Disable TOC for a specific pageadd_filter( 'wbmw_toc_html', function( $html, $headings ) { if ( is_singular( 'wiki_page' ) && get_the_ID() === 123 ) { return ''; } return $html;}, 10, 2 );Can I customize the TOC appearance?
Yes. The TOC is wrapped in a <div class="wbmw-toc"> element. Add CSS to your theme to override the default styles:
/* Custom TOC box styling */.wbmw-toc { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 16px 20px; display: inline-block; min-width: 200px; margin-bottom: 20px;}
.wbmw-toc nav ol { margin: 0; padding-left: 20px;}You can also modify the TOC HTML programmatically via the wbmw_toc_html filter (see Hooks & Filters Reference).
Does the TOC affect the page heading hierarchy for SEO?
No. The TOC is injected via a WordPress content filter (the_content) after the page is saved. It reads your heading structure but does not modify the actual page content in the database.

