Should I use custom post types or a custom database tables for plugin development?

You should be skeptical of anyone who says that there is a single “right” way. The right way depends on the situation. Using the CPT infrastructure has a number of notable benefits: You get the Dashboard UI for free You automatically take advantage of WP’s caching, including any persistent cache plugins that the installation may … Read more

Permalinks: custom post type -> custom taxonomy -> post

First, register your taxonomy and set the slug argument of rewrite to shows: register_taxonomy( ‘show_category’, ‘show’, array( ‘rewrite’ => array( ‘slug’ => ‘shows’, ‘with_front’ => false ), // your other args… ) ); Next, register your post type and set the slug to shows/%show_category%, and set has_archive argument to shows: register_post_type( ‘show’, array( ‘rewrite’ => … Read more

How to create a custom search for custom post type?

Here is what I’ve tried and got a solution with 3 steps. Let’s say your custom post type is “products“ 1 . Add Function Code here you can specify the archive-search.php function template_chooser($template) { global $wp_query; $post_type = get_query_var(‘post_type’); if( $wp_query->is_search && $post_type == ‘products’ ) { return locate_template(‘archive-search.php’); // redirect to archive-search.php } return … Read more

How to sort the admin area of a WordPress custom post type by a custom field

As you can probably imagine by the lack of answers provided, the solution is not exactly trivial. What I’ve done is create a somewhat self-contained example that assumes a custom post type of “movie” and custom field key of “Genre“. Disclaimer: this works with WP3.0 but I can’t be sure it will work with earlier … Read more

How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name

After combining a bunch of pieces of other answers I got it working! So here’s the solution for those of you who are struggling with this too: This post and this one helped me out some, so thanks to those guys. Note, all this code, plus your initial custom post type and taxonomy registration code … Read more