Get all properties of custom post type

To get all the post_meta for a post, use: $postmeta = get_post_meta(1738); print_r($postmeta); …which will give you a nested array of values that you can explore. Once you’ve worked out what you need, you can get the individual setting / property / meta with: $mySetting = get_post_meta(1738, “my-post-meta-key”, true); Take a look at the relevant … Read more

Can’t change first part of URL rewrite for custom post type

The problem is with that add_rewrite_tag(‘%keyterms%’, ‘(.*)’), which results in rewrite conflicts because the generated rewrite rules would match http://example.com/(anything-here) and that (anything-here) can be a Page (post type page) slug, hence http://example.com/page-slug would not work — you wouldn’t get a 404 error page, but the proper Page wouldn’t be displayed, either. So looking at … Read more

Wrong generated page_name/slug on first publish of custom post type

When registering or updating any rewrite for any post/custom post type you need to flush rewrite rules by the admin panel or via code: register_activation_hook( __FILE__, ‘plugin_activation’ ); function plugin_activation() { update_option(‘plugin_permalinks_flushed’, 0); } add_action( ‘init’, ‘register_custom_post_type’ ); function register_custom_post_type() { global $wp; register_post_type( ‘review’, array( ‘label’ => ‘Reviews’, ‘labels’ => array( ‘name’ => ‘Reviews’, … Read more

Adding dropdown select meta box to custom post type – seems restAPI is interfering

But I don’t understand: why does the mere act of checking off that a post type is visible to restAPI cause wordpress’s backend editor to go into a completely different mode of operation? WordPress 5.0 introduced the Block Editor. This is an entirely new post editing screen and method of editing posts. It works by … Read more