Insert terms for custom taxonomy on plugin activation, or each page load (init hook)

50 is relatively not much, and you should create them on the plugin activation hook. For more then 100 (just pulled the number out of my ass 😉 do your own testing on some slow shared hosting) I would create a settings page and initialize the DB from there. The reason is that users do … Read more

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