Custom Post Type – after disable ‘Add New’, I can’t edit and delete post

Full credit to this answer on Stack Overflow: you need to set the create_posts value to do_not_allow (or false in WordPress versions below 4.5) and crucially set the map_meta_cap to true: register_post_type( ‘custom_post_type_name’, array( ‘capability_type’ => ‘post’, ‘capabilities’ => array( ‘create_posts’ => ‘do_not_allow’, // Prior to WordPress 4.5, this was false ), ‘map_meta_cap’ => true, … Read more

CPT with its own category and tag url

First, we need to declare CPT. Here in example I am creating with the name “command“. Also I am adding category and tag support for this CPT. The CPT will be public, searchable, will have archive page, feed page etc. add_action( ‘init’, ‘create_post_type’ ); function create_post_type() { $post_array = array( ‘name’ => __( ‘Command’ ), … Read more

Add custom columns in custom post type browse page

Here is an sample of my plugin’s code where I set a custom post type “aei_team_member” and add 2 columns (Prénom and Photo where Photo is a thumbnail) in admin list using : manage_${post_type}_posts_columns and manage_{$post_type}_posts_custom_column Further information can be found here: https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column I hope it helped! /** * Adds a thumbnail column in the … Read more