My custom post type doesn’t seem to be pulling through to the admin dashboard. I have done it as a plugin and have activated it but to no avail. Shouldn’t it show up down the left hand side? I also cant seem to find any errors in the code
<?php
/**
* Plugin Name: Production.
* Description: Create a new production for your website.
*/
class Production {
function __construct(){
add_action( 'init', 'my_custom_post_product' );
}
function my_custom_post_product() {
$labels = array(
'name' => _x('Productions','post type general name'),
'singular_name' => _x('Production','post type singular name'),
'add_new' => _x( 'Add New', 'Production' ),
'add_new_item' => __( 'Add New Production' ),
'edit_item' => __( 'Edit Production' ),
'new_item' => __( 'New Production' ),
'all_items' => __( 'All Productions' ),
'view_item' => __( 'View Production' ),
'search_items' => __( 'Search Productions' ),
'not_found' => __( 'No productions found' ),
'not_found_in_trash' => __( 'No productions found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Productions');
$args = array(
'labels' => $labels,
'description' => 'Holds the productions',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
);
register_post_type( 'Production', $args );
}
}
Your ‘menu_name” is set incorrectly. Should be:
Source:
https://codex.wordpress.org/Function_Reference/register_post_type#Example