Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

There are a few plugins which can assist you in building your CPT's, and these can usually handle your taxonomies and sometimes postmeta also. Some even take it further than that. I know that as with any plugin it's possible that development may cease; but aside from that are there any reasons why it's better to code your own CPT's taxonomies etc.

Here are some of the plugins I'm referring to

  • Custom Post Type UI
  • Types
  • WCK
  • Custom Post Type Maker

Here's my Advantage/Disadvantage list

Advantages

  • Quicker and Easier
  • Developers have hopefully considered security so no need to worry about nonces or protecting the database etc

Disadvantages

  • Might be a performance issue for some applications
  • Depending on development to continue.
  • Possibly Less Flexible

Does anyone want to add to or take away from this list?

share|improve this question
1  
This is really a matter of opinion and not a question which has a correct answer. also, there's nothing exploitable in a simple register_post_type call, on the contrary, who knows what additional, exploitable code these plugins may contain, so that item should be moved to the disadvantages column. –  Milo Nov 20 '13 at 17:16

2 Answers 2

up vote 2 down vote accepted

I think there's no really huge difference, you choose the tool that you feel most comfortable yourself. Plugins have the drawbacks you mentioned, and doing them from scratch can be a bit slow and tedious.

The 3rd alternative, that I find really good, is a PHP class that does all the heavy lifting for you, but is still light and easy to use, e.g. Easy-WordPress-Custom-Post-Types. This particular class does custom taxonomies and metaboxes also. Very handy. So you'll eliminate bunch of plugins with one hit.

share|improve this answer
    
Nice tip thanks –  byronyasgur Nov 21 '13 at 0:08

This really isn't a good question. But if you're a developer you really should register your own custom post types in the functions.php file of the theme you're using.

look at the template below:

    add_action( 'init', 'register_cpt_[post_name]' );
function register_cpt_[post_name]() {
$labels = array(
'name'               => '[post name]',
'singular_name'      => '[singular post name]',
'add_new'            => 'Add New',
'add_new_item'       => 'Add New [post name]',
'edit_item'          => 'Edit [post name]',
'new_item'           => 'New [post name]',
'all_items'          => 'All [post name]',
'view_item'          => 'View [post name]',
'search_items'       => 'Search [post name]',
'not_found'          => 'No [post name] found',
'not_found_in_trash' => 'No [post name] in Trash',
'parent_item_colon'  => '',
'menu_name'          => '[post name as it will appear in the WP dashboard]'
);

$args = array(
'labels'             => $labels,
'public'             => true,
'publicly_queryable' => true,
'show_ui'            => true,
'show_in_menu'       => true,
'query_var'          => true,
'rewrite'            => array( 'slug' => '[post-name]' ),
'capability_type'    => 'post',
'has_archive'        => true,
'hierarchical'       => false,
'menu_position'      => null,
'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt',     'comments' )
);
register_post_type('[post_name]', $args);
};
share|improve this answer
    
Please, no. Never register post types in a theme. –  toscho Nov 20 '13 at 21:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.