We normally need to create custom post type, there are couple of plugins available at WordPress.org if you want to create custom post type without increasing your active plugin list, you can use following steps.

Step 1 – Register A Custom Post Type.

Open your functions.php file in current active theme’s root directory and add the code below to it. Make sure the code is added before the closing PHP tag ( ?> ). I will explain the code below.


* Creates Custom Post Type  Movie Reviews


* @since         1.0.0

* @author       Wbcom Designs



function wbcom_movie_reviews_init() {

$wbcom_args = array(

                        'label'                         => 'Movie Reviews',

                        'public'                       => true,

                        'show_ui'                   => true,

                        'capability_type'     => 'post',

                        'hierarchical'            => false,

                        'rewrite'                    => array('slug' => 'movie-reviews'),

                        'query_var'               => true,

                        'menu_icon' => 'dashicons-video-alt',

                        'supports'                  => array(













            register_post_type( 'movie-reviews', $wbcom_args );


add_action( 'init','wbcom_movie_reviews_init' ) ;


Code Definitions


function wbcom_movie_reviews_init() — Here we create a new function for our custom post type. We do this to limit conflicts with any other code inside our functions.php file. It is also a best practice when adding new code to any file like functions.php.


label  –  A plural descriptive name for the post type marked for translation. If you don’t declare a custom label, WordPress will use the name of the custom post type by default.


public – Whether a post type is intended to be used publicly either via the admin interface or by front-end users. WordPress sets this to false by default.Here we set it to true as we do what our custom post type to display publicly.


show_ui – Generates a default UI for managing this post type in the admin. You can set this to true or false. For the sake of usability, a UI in the admin area is always a good thing.


capability_type – Here we can declare what type of custom post type we will be dealing with. It is used to build the read, edit, and delete capabilities of a post or page. You can choose either post or page.


hierarchical – Whether the post type is hierarchical(e.g. page). Or in laymen’s terms, whether or not you can declare a parent page, child page, etc… of the post type. This is mainly intended for Pages. Here we declare it false so there’s no need to worry about it for our example.


rewrite – This rule is either true or false. The default is true so if slug argument is entered then the slug name is prepended to the posts. Our slug “movie-reviews” will be prepended to each new post of that type.


query_var – This rule is either true or false. It sets the post type name as a query variable.


menu_icon – This rule declares a custom icon for the admin area. Here we use a neat resource called dashicons that are included in WordPress already.


supports – This is usually an array of features the custom post type will support. Here we have quite a long list. These will tie into the admin area.


register_post_type($post_type, $args); – The register_post_type() is a function that WordPress recognizes as a custom post type generator. In this example it accepts two parameters which are the name of the post type itself and any arguments you would like to call.


add_action(‘init’, ‘movie_reviews_init’ ); – This line of code returns or calls our function so it fires and displays within our site.


Step 2 – Test

Now that we have defined our custom post type inside our functions.php file, head to your WordPress dashboard to see that we did everything correctly. You should now have a new menu item on the left side of your screen titled Movie Reviews.

Custom Post Type


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.