WordPress Custom Post Type With Tags

I wanted to create a WordPress custom post type but have it be just like a regular blog post with all the same basic functionality. I was able to accomplish this by editing my theme’s functions and adding a hook into tho init event using the register_post_type function. Here is what it ended up looking like:

add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'review',
        array(
            'labels' => array(
                'name' => __( 'Reviews' ),
                'singular_name' => __( 'Review' )
            ),
            'taxonomies' => array( 'post_tag' ),
            'public' => true,
            'has_archive' => true,
            'supports' => array(
                'title',
                'editor',
                'author',
                'thumbnail',
                'custom-fields',
                'comments',
                'revisions'
            )
        )
    );
}

This is what the end result looks like. Just what I wanted.

 

Resources

https://codex.wordpress.org/Function_Reference/register_post_type

https://codex.wordpress.org/Glossary#Post_Type

Published by

MikeGrace

I am a Geek! I hope you enjoyed this recent post.

One thought on “WordPress Custom Post Type With Tags”

Comments are closed.