Skip to content

Wiki Links & Interlinks

Wiki links are the backbone of a knowledge base. WB Member Wiki uses MediaWiki-style double-bracket syntax to create links between wiki pages, automatically building a web of interconnected content.

The [[Industrial Revolution]] transformed manufacturing.

Links to the wiki page titled “Industrial Revolution”. The matching is case-insensitive.

The [[Industrial Revolution|rise of industry]] changed everything.

Displays “rise of industry” as the link text, linking to the “Industrial Revolution” page.

When a wiki page is displayed, the plugin scans the content for all [[...]] patterns and resolves them in a single batch query for performance:

  1. All referenced page titles are collected
  2. A single database query fetches matching wiki pages
  3. Each link is replaced with the appropriate HTML
State Appearance Behavior
Existing page Standard blue hyperlink Links directly to the wiki page
Missing page Styled differently (red/special class) Indicates the page can be created

Every wiki page automatically tracks which other pages link to it. This creates a bidirectional linking system:

  • Outgoing links - Pages this page links to via [[...]] syntax
  • Backlinks - Pages that link to this page

When you save a wiki page, the plugin:

  1. Extracts all [[...]] wiki links from the content
  2. Resolves each link to a page ID
  3. Stores individual _wbmw_links_to meta entries for each target page
  4. This index enables fast backlink lookups without content scanning

Backlinks are displayed on the wiki page, showing up to 50 pages that link to the current page. This helps users discover related content and understand how topics connect.

The interlinking system is optimized for large wikis:

  • Batch resolution - All wiki links on a page are resolved in a single database query
  • Post meta index - Backlinks use indexed meta queries (_wbmw_links_to) instead of slow LIKE content searches
  • Result caching - Page lookups are cached per request to avoid redundant queries
  • Reference related concepts that have their own wiki pages
  • Link to prerequisite or follow-up topics
  • Connect parent topics to child topics and vice versa
  • Link on first mention - Add the wiki link the first time a concept appears in your page, not every occurrence
  • Use natural language - Write links that flow naturally in sentences
  • Create before linking - Consider creating stub pages for important topics, then expand them later
  • Check for typos - Links resolve by exact title match, so “Quantam Computing” won’t link to “Quantum Computing”

Not every noun needs a wiki link. Link to pages that provide genuinely useful additional context. A page with too many links becomes hard to read.

Wiki links are processed via the the_content filter at priority 5, running before most other content filters:

// The interlinking class handles parsing
$interlinking = new WBMW_Interlinking();
add_filter( 'the_content', array( $interlinking, 'parse_wiki_links' ), 5 );

The generated HTML uses these CSS classes:

Class Element
.wbmw-wiki-link Existing page link
.wbmw-wiki-link-new Missing page link