smiling woman looking at laptop

How to Create a Wiki Using WordPress

The internet is full of wikis, because they are easy to use and they make sharing information fast. In fact, there are many reasons why you might want to create your own wiki. If you use WordPress, however, you may wonder if you can create a wiki with that software. 

WordPress wasn’t designed with wikis in mind, but it is still flexible enough to accommodate them. By using the right tools, you can create your own WordPress wiki quickly and easily. There are even multiple methods you can try, including plugins, themes, and custom code snippets. 

In this article, we’ll explore how to build your wiki with WordPress. Let’s jump right in!

Getting Started on Your WordPress Wiki

Before you can start building your wiki, there are certain resources you’ll need. These things will make the process faster and easier:

  • A WordPress website. You should have hosting and a domain, as well as a WordPress website
  • A knowledge base integration method. There are three main ways to add a wiki to your existing site. You can use a subdomain, add a new directory with its own WordPress installation, or use WordPress multisite.
  • The content for your wiki. Having the content ready to go helps you get your wiki live sooner. This can include documentation, FAQs, and other support materials. 

With these three elements in place, you’re ready to set up the wiki itself.

Creating a WordPress Wiki: Step-By-Step Process

There are three methods commonly used to create a WordPress wiki site: plugins, themes, and custom code snippets. We suggest reading through all three options, and then choosing the one that works best for your needs.

Using a WordPress Wiki Plugin

If you have an existing website and want to add a wiki to it, a plugin might be the best solution. Plugins are the least intrusive method, and you can continue using your existing theme.

Try Using These Plugins to Create Your Wiki

While there are many wiki plugins available, you might want to consider the following:

Any of these tools can get the job done, so the choice will come down to personal preference.

Step 1: Install and Activate Your Plugin

To start building your wiki, install and activate your chosen plugin. In our example, we’ll use the Yada Wiki plugin. You can install it in your WordPress dashboard, or by visiting the WordPress Plugin Directory.

Step 2: Add Wiki Content

After the plugin is activated, a wiki will be automatically created for your website under www.yourwebsite.com/wiki. You can start adding content to it right away:

Add new wiki page

Navigate to Wiki Pages > Add New. Add a title to the page, and insert (or create) the content. This process is very similar to adding a post or page to your WordPress website. 

Once your content is ready, you can add a category, tags, and featured image. Then click on Publish to add the wiki page to your website. 

Step 3: Update Your Plugin Settings

Along with adding content, you may also want to configure your wiki’s settings. We’ll do this by going to Settings > Yada Wiki

Yada Wiki plugin settings

Here you can update the slug for your wiki, if you want it to appear at a different URL. You can also allow comments, pingbacks, and use of the Block Editor

Using a WordPress Wiki Theme

Using a WordPress wiki theme is one of the easiest ways to build your website. This is the best solution if you are not using your main website for your wiki, or if your website will contain only a wiki and nothing else.

Try Using These Themes to Create Your Wiki

There are many themes you can use for your wiki. Here are a few options to get you started:

  • MyWiki: A fast and minimalist free theme.
  • MyKnowledgeBase: A lightweight free theme with customizable templates.
  • Flatbase: A highly-responsive premium option with lots of customization potential.
  • KnowHow: A great choice for building a stylish wiki quickly.

The premium themes generally offer greater customization and more features than the free options, but both can get the job done.

Step 1: Install WordPress on a Subdomain or Directory

If you do not want the wiki to be your primary website, you’ll need to install WordPress on a subdomain or directory. The steps required for this will vary depending on your web host.

After creating your subdomain or directory, install WordPress on it. You can generally do this using the one-click installation feature offered by your hosting provider. 

Step 2: Choose a Wiki Theme and Install It

Once your WordPress installation is ready, you’ll need to install a wiki theme. If you are using a free theme, go to Appearances > Themes and click on Add New. Search for the theme you want, and click on Install and then Activate:

Install Wiki theme

If you are using a premium theme, you’ll need to upload its zip file. Go to Appearances > Themes > Add New, and select Upload Theme. Remember to activate the theme once the upload is complete. 

Step 3: Customize the Theme

After installation, you’ll want to customize and personalize your theme. To do this, navigate to Appearances > Customize. This opens the your website preview and provides access to many configuration settings:

customize wiki theme

Customizing your wiki’s looks is similar to adjusting any WordPress theme. When you are happy with the appearance of your website, click on Publish to make your changes live.

Step 4: Add Wiki Content

You can add content to your wiki theme the same way you’d add new posts and pages. Depending on your chosen theme, you may do this under Posts or Pages, or there might be a specialized Wiki content type.

Either way, you can generally use the familiar WordPress editor to add and edit your wiki content. Don’t forget to publish each piece when it’s ready, so visitors can view it.

Using a Custom Code Snippet

The final method for creating a wiki on an existing or new WordPress site is through custom code snippets. This method provides a lot of freedom, but can be intimidating for beginners. If you are going to use code snippets, remember to make a full backup of your website first.

Step 1: Install and Activate Knowledge Base CPT

To start using code snippets, you can install and activate the plugin Knowledge Base CPT. This plugin is recommended because it creates a custom post type called Knowledge Base and a taxonomy called section.

Step 2: Add and Organize Your Wiki Content

After activating the plugin, add your wiki content to the website. Go to Knowledge Base > Add New:

Add new wiki content

Adding content here is the same as creating a new post or page on your WordPress website. When the content is ready, click on Publish to add it to your website. 

Step 3: Add the Code Snippets

You are now ready to add code snippets to your site’s functions.php file. This file is found under Appearances > Theme Editor. Add the following code to it:

function wpb_knowledgebase() {
    // Get Knowledge Base Sections
    $kb_sections = get_terms('section','orderby=name&hide_empty=0');
    // For each knowledge base section
    foreach ($kb_sections as $section) :
    $return .= '<div class="kb_section">';
    // Display Section Name
    $return .= '<h4 class="kb-section-name"><a href="'. get_term_link( $section ) .'" title="'. $section->name .'" >'. $section->name .'</a></h4><ul class="kb-articles-list">';
    // Fetch posts in the section
    $kb_args = array(
        'post_type' => 'knowledge_base',
        'posts_per_page'=>-1,
        'tax_query' => array(
            array(
                'taxonomy' => 'section',
                'terms'    => $section,
            )       ,
        ),
    );
    $the_query = new WP_Query( $kb_args );
        if ( $the_query->have_posts() ) : 
            while ( $the_query->have_posts() ) : $the_query->the_post(); 
                $return .=  '<li class="kb-article-name">';
                $return .=  '<a href="'. get_permalink( $the_post->ID ) .'" rel="bookmark" title="'. get_the_title( $the_post->ID ) .'">'. get_the_title( $the_post->ID ) .'</a>';
                $return .=  '</li>';
            endwhile; 
    wp_reset_postdata(); 
         else : 
                $return .= '<p>No Articles Found</p>';
        endif; 
    $return .=  '</ul></div>';
    endforeach;
    return $return;
}
// Create shortcode 
add_shortcode('knowledgebase', 'wpb_knowledgebase');

This code lists all of your wiki articles under the relevant sections.

Next, you’ll need to create a new WordPress page for your knowledge base. Go to Pages > Add New and title it Knowledge Base

In the editor, choose the Shortcode block. Enter [knowledgebase], and publish the page. This creates a plain wiki page. You can then add the following code to the style.css file in the Theme Editor to adjust it:

.kb_section {
float: left;
width: 280px;
max-width: 280px;
margin: 10px;
background-color: #f5f5f5;
border: 1px solid #eee;
}
h4.kb-section-name {
background-color: #eee;
margin: 0;
padding: 5px;
}
ul.kb-section-list {
list-style-type: none;
list-style: none;
display: inline;
}   
li.kb-section-name {
list-style-type: none;
display: inline;
}
ul.kb-article-list {
list-style-type: none;
list-style: none;
}   
li.kb-article-name {
list-style-type: none;
}
div.kb_section:nth-of-type(3n+1) {clear:left;}
div.kb_section:nth-of-type(3n+3) {}

Finally, you can save the file and preview the changes to your website

Explore WP Engine’s Developer Resources

Adding a wiki to your WordPress website is possible with plugins, themes, and custom code snippets. The method you choose depends on the location of your wiki, and how you want to use it.

No matter what type of site you’re building, you’ll need access to the best resources in order to ensure an incredible digital experience. WP Engine offers this and more, leaving you time to focus on WordPress development!

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.