Recently, I worked with a client who is a professional consultant in her field. She wanted me to create a Q&A system — basically a structured FAQ page. At first, I suggested a simple solution: just add all the questions and answers directly on a page with some styling.
But she had something more organized in mind:
Each question and answer should have its own page
Questions should be grouped into categories
The system should be easy to embed anywhere on the site
That’s when I decided to use a combination of Custom Post Types (CPTs), Taxonomies, and Shortcodes in WordPress. This approach not only kept the content organized but also made it SEO-friendly, since each FAQ item could be indexed separately by Google.
Why Create FAQs with CPTs Instead of Just a Page?
✅ Better SEO – Each question gets its own URL, making it more likely to rank for search queries.
✅ Organized Content – Group FAQs into categories (e.g., “Payments,” “Refunds,” “Shipping”).
✅ Reusable – Easily display FAQs anywhere on your site using a shortcode.
✅ Scalable – Add new FAQs anytime without editing a long static page.
Step 1: Create the FAQ Custom Post Type
First, we’ll register a new FAQ post type. This gives us a dedicated section in WordPress where we can add questions and answers.
// Register FAQ Custom Post Type
function faq_custom_post_type() {
$labels = array(
'name' => 'FAQs',
'singular_name' => 'FAQ',
'menu_name' => 'FAQs',
'add_new' => 'Add New',
'add_new_item' => 'Add New FAQ',
'edit_item' => 'Edit FAQ',
'new_item' => 'New FAQ',
'view_item' => 'View FAQ',
'all_items' => 'All FAQs',
'search_items' => 'Search FAQs',
'not_found' => 'No FAQs found'
);
$args = array(
'labels' => $labels,
'public' => true,
'menu_icon' => 'dashicons-editor-help',
'supports' => array('title', 'editor'),
'has_archive' => true,
'rewrite' => array('slug' => 'faq'),
);
register_post_type('faq', $args);
}
add_action('init', 'faq_custom_post_type');
Step 2: Create FAQ Categories with a Custom Taxonomy
To organize FAQs into groups, we’ll add a taxonomy (like “Shipping,” “Billing,” “Support”).
// Register FAQ Categories
function faq_custom_taxonomy() {
$labels = array(
'name' => 'FAQ Categories',
'singular_name' => 'FAQ Category',
);
register_taxonomy(
'faq_category',
'faq',
array(
'hierarchical' => true,
'labels' => $labels,
'rewrite' => array('slug' => 'faq-category'),
)
);
}
add_action('init', 'faq_custom_taxonomy');
Now, in the WordPress admin, you’ll see FAQ Categories where you can classify each question.
Step 3: Create the FAQ Shortcode
Finally, let’s make a shortcode so you can display FAQs on any page or post.
// Shortcode: [faq category="slug"]
function faq_shortcode($atts) {
$atts = shortcode_atts(array(
'category' => '',
), $atts);
$args = array(
'post_type' => 'faq',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
);
if (!empty($atts['category'])) {
$args['tax_query'] = array(
array(
'taxonomy' => 'faq_category',
'field' => 'slug',
'terms' => $atts['category'],
)
);
}
$query = new WP_Query($args);
$output = '<div class="faq-list">';
while ($query->have_posts()) : $query->the_post();
$output .= '<div class="faq-item">';
$output .= '<h3 class="faq-question">' . get_the_title() . '</h3>';
$output .= '<div class="faq-answer">' . get_the_content() . '</div>';
$output .= '</div>';
endwhile;
wp_reset_postdata();
$output .= '</div>';
return $output;
}
add_shortcode('faq', 'faq_shortcode');
Usage examples:
-
[faq]→ Shows all FAQs -
[faq category="shipping"]→ Shows only FAQs in “Shipping”
Step 4: SEO Tips for FAQs
-
Use clear, question-based titles (
How do I reset my password?). -
Add FAQPage Schema (JSON-LD) for rich results in Google.
-
Group FAQs into categories with descriptive slugs.
-
Add internal links in answers (e.g., “See our refund policy”).