How to show the category filter that’s shown on the ‘All post’ pages on a custom post type page in the admin area?

If your post type supports the category taxonomy, then that drop-down menu would be displayed by default: register_post_type( ‘my_cpt’, [ ‘public’ => true, ‘taxonomies’ => [ ‘category’ ], // here, the post type supports the `category` taxonomy //… ] ); Otherwise, or for custom taxonomies, you can use the restrict_manage_posts hook and wp_dropdown_categories() to add … Read more

Post taxonomy from exif data

Retrieving attachment image EXIF data As “a plugin” won’t help later visitors, let’s start off with how to retrieve that: # Get the post ID: Use one of the following. Preferred is the API function get_the_ID() # $GLOBALS[‘post’]->ID; # global $post; $post->ID; # get_the_ID(); $meta = wp_get_attachment_metadata( get_the_ID(), false ); # Fetch the EXIF data … Read more

Add multiple custom post types in functions.php, but only one custom post type show in dashboard

add add_action(‘init’, ‘create_new_cpt2’); in your snippet and modify add_db_to_article function as below, function add_db_to_article ($post_types) { $custom_post_types = array (‘article’, ‘news’); $output = array_merge($post_types, $custom_post_types); return $output; } Note: ‘news’ is added in $custom_post_types array.