Support » Fixing WordPress » cheatin' uh? [fix]

  • Joe Joel


    I know there is a thread on this topic and that it’s been closed because it was generating more fuss than solving anything.
    I am creating this one as i have discovered something that might lead the developers towards a solution.
    Behold this piece of code:

    add_action( 'init', 'create_slide_post_type' );
    function create_slide_post_type() {
    	register_post_type( 'slide',
                    'labels' => array(
    				'name' => __( 'Slides' ),
    				'singular_name' => __( 'Slide' )
    		'public' => true,
                    'publicly_queryable' => false,
                    'show_ui' => true,
                    'show_in_nav_menus' => false,
                    'menu_position' => 5,
                    'query_var' => false,
                    'rewrite' => false,
    //                'capabilities' => array('slide', 'slides'),
                    'hierarchical' => false,
                    'supports' => array('thumbnail', 'excerpt', 'title' ),
                    'taxonomies' => array('category')

    Uncommenting the commented line is triggering the error for me when trying to set a featured image for the custom post.
    Feel free to close this thread, but make sure to forward the information to the ones that should see it.
    Also if it’s a custom theme that you encounter this error with, you might want to check if the theme is using custom posts (and many do).

Viewing 1 replies (of 1 total)
  • Are you talking about some particular plugin, or are you trying to build custom post types by hand?

    At any rate, the reason your solution works is that the “capabilities” line is for things like “edit_posts” or “publish_posts” — things that a user of a certain level should be able to do. A capability of “slides” is nonsensical; nobody is ever going to be allowed to create posts, unless you just happen to have defined a custom capability elsewhere in the site.

    Removing the line is safe — the default is to allow CPTs to be managed by anyone with the same powers over posts, so it’s not like you’re opening things up to just anybody — as long as that’s the capability you actually want.

Viewing 1 replies (of 1 total)
  • The topic ‘cheatin' uh? [fix]’ is closed to new replies.