Configuring CPT Arguments: Mastering Knowledge Article Registration
Learn how to fine-tune your WordPress CPT arguments. Master supports, rewrite slugs, and hierarchical structures to build a professional Knowledge Base.
Previously in this course, we covered the basics of Registering Custom Post Types using the register_post_type function. In this lesson, we will move beyond the default settings to fine-tune our "Knowledge Article" CPT with advanced configuration arguments.
Proper CPT configuration is the difference between a functional post type and a professional-grade feature. By controlling supports, hierarchy, and URL structure, you ensure your plugin behaves exactly as your users expect.
The Power of the supports Argument
When you register a CPT, WordPress defaults to a very minimal setup. To make our Knowledge Articles useful, we must explicitly enable the features that our users need. The supports argument accepts an array of strings that tell WordPress which UI elements to render in the editor.
For our Knowledge Base plugin, we want our articles to have a title, body content, and a featured image. We should also enable revisions so users can track changes.
PHP$args = array( 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'excerpt' ), #6A9955">// ... other arguments );
If you omit this argument, WordPress defaults to only title and editor. Adding thumbnail is critical if you plan to display these articles with featured images in a grid or list view.
Controlling URL Structure with rewrite
By default, WordPress uses the CPT name as the URL slug. If your CPT is registered as kb_article, your URLs will look like example.com/kb_article/my-article-title. This is often not ideal for SEO or branding.
The rewrite argument allows you to customize the URL structure. You can pass a boolean false to disable rewrites, or an associative array to define a custom slug.
PHP'rewrite' => array( 'slug' => 'knowledge-base', 'with_front' => false, ),
Setting with_front to false is a pro tip: it prevents your custom slug from being prefixed by your site's base permalink structure (e.g., /blog/knowledge-base/). For a deeper look at how WordPress processes these patterns, refer to WordPress rewrite rules: How Regex Patterns Generate from Permalinks.
Implementing Hierarchical Support
Most custom post types behave like blog posts (flat lists). However, a Knowledge Base often benefits from parent-child relationships, where one article acts as a category or a "parent" to several sub-articles.
To enable this, we set hierarchical to true and ensure page-attributes is added to the supports array.
PHP'hierarchical' => true, 'supports' => array('title', 'editor', 'page-attributes'),
When hierarchical is set to true, the post editor will display a "Parent" dropdown in the sidebar, allowing you to nest articles. This changes the URL structure if you include the parent slug, creating a logical tree for your documentation.
Hands-on Exercise: Refining the Knowledge Article
Open your CPT registration class. Update your register_post_type arguments to include the following configuration:
- Supports: Add
title,editor,thumbnail, andpage-attributes. - Rewrite: Set the slug to
kb-articlesand ensurewith_frontisfalse. - Hierarchical: Set
hierarchicaltotrue.
After saving the file, you must visit the Permalinks settings page in your WordPress dashboard to flush the rewrite rules. If you skip this step, your new URLs will likely return a 404 error.
Common Pitfalls
- Forgetting to Flush Permalinks: This is the #1 cause of "my new CPT returns a 404." Whenever you change a
rewriteargument, you must trigger a rewrite rule refresh. - Assuming Defaults: Never assume
supportswill include everything you need. If a feature (likethumbnailorexcerpt) isn't working, check yoursupportsarray first. - Hierarchical Confusion: If you set
hierarchicaltotruebut forgetpage-attributesin yoursupportsarray, you won't see the parent-child UI in the editor, even though the database logic is enabled.
Recap
We have successfully advanced our Knowledge Base plugin by configuring the CPT to support modern editing features and clean, custom URL structures. By using supports, rewrite, and hierarchical arguments, we've transformed a basic post type into a structured content system.
Up next: We will organize our content further by learning how to add custom taxonomies to our Knowledge Article CPT.
Work with me

Custom WordPress Plugin Development
Custom WordPress & WooCommerce plugins built to standard — by the developer behind a plugin with 5,000+ active installs and a SaaS with 10,000+ users.

Custom WordPress Theme Development
A custom WordPress theme built exactly to your design — fast, clean, and easy to manage. No bloated page builders, no compromises.