Are you sure you want to do this? Please try again. WordPress 3.0 custom post type error.

Sorry for the longest title in the history of my blog, I just want other developers to find my site and find the info they need to.  I found out that wordpress custom post types can throw back an error if the name is more than 20 characters.

Here's an example of what NOT to do.

//COMPANY PAGE BOTTOM RIGHT
add_action( 'init', 'create_my_post_types17' );

function create_my_post_types17() {
register_post_type( 'company_block_middle_post',
array(
'labels' => array(
'name' => __( 'Company Middle'),
'singular_name' => __( 'Company Middle' )
),
'public' => true,
)
);
}

The error I kept running into was "Are you sure you want to do this? Please try again." when I tried to publish a new custom post. I spent about an hour tweaking my database settings, overwriting old admin files and trying different combinations of numbers and names for my custom post until I broke down and searched Google for an answer.

Thanks to this post , http://it.knightnet.org.uk/2010/06/bug-in-wordpress-30-custom-post-types.html , I figured it out and changed the name from "company_block_middle_post" to a much shorter "cmpny_middle".

IT WORKED!

I'm back in business and now everything is running smooth. Other than that little snag I love everything about WordPress 3.0 and custom content/post types.

Share
This entry was posted in Wordpress. Bookmark the permalink.
  • http://www.knightnet.org.uk knightnet

    Glad you found this useful Will. Thanks for the link.

    • http://www.wilwaldon.com William Waldon

      It was very useful. Thank you for the great tip.

  • Juan López

    I am surprised this answer did not come up first on my Google search.

    It was in fact the issue with my site.