• Resolved jwonlineuk

    (@jwonlineuk)


    Hi there,

    I’ve added a custom post type using the following code:

    function slide_init() {
    	$labels = array(
    		'name' => 'Slides',
    		'singular_name' => 'Slide',
    		'add_new' => 'Add New',
    		'add_new_item' => 'Add New Slide',
    		'edit_item' => 'Edit Slide',
    		'new_item' => 'New Slide',
    		'view_item' => 'View Slide',
    		'search_items' => 'Search Slides',
    		'not_found' => 'No slides found',
    		'not_found_in_trash' => 'No slides found in Trash',
    		'parent_item_colon' => '',
    		'menu_name' => 'Slides'
    	);
    	$args = array(
    		'labels' => $labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'show_in_menu' => true,
    		'query_var' => true,
    		'rewrite' => true,
    		'capability_type' => 'post',
    		'has_archive' => true,
    		'hierarchical' => false,
    		'menu_position' => null,
    		'supports' => array( 'title', 'editor', 'thumbnail' )
    	);
    	register_post_type( 'slide', $args);
    }
    add_action( 'init' , 'slide_init');

    The post type has been added to the admin menu, but clicking on it produces not a list of slides, but a list of all posts. Oddly enough, the post count in the top left is displaying correctly (see screenshot below). This behaviour occurs even with all plugins deactived. I have visited the permalinks page to flush the rewrite rules but that made no difference. Any ideas?

    Screenshot

    Cheers,
    James

Viewing 1 replies (of 1 total)
  • Thread Starter jwonlineuk

    (@jwonlineuk)

    Resolved the problem. I had a function adding another custom post type to the main query, and had forgotten to stop it from calling on admin pages. Thanks to anyone who had taken a look at this.

    James

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type Admin not showing correctly’ is closed to new replies.