Custom post type editor uses old tinyMCE

In your code where you defined your custom post type (in a custom plugin or in your functions.phpfile), you need to add this snippet for Gutenberg block editor support: ‘show_in_rest’ => true, ‘supports’ => array(‘editor’) Here is an example: function portfolio_post_type() { register_post_type( ‘portfolio’, array( ‘labels’ => array( ‘name’ => __( ‘Portfolio’ ), ‘singular_name’ => … Read more

Get rid of “trash can” for custom post type

If you wanted to do this for all post types, you’d simply do define(‘EMPTY_TRASH_DAYS’, 0); see https://codex.wordpress.org/Trash_status#EMPTY_TRASH_DAYS_option. But since you only want to do this for a custom post type, you will need to hook into ‘trashed_post’ like this: add_action(‘trashed_post’, function( $post_id ){ […] then check your trashed posts’ post type: if ( get_post_type($post_id) === … Read more

Custom Post type: Labels are not showing

You have put these labels inside the capabilities argument, which is incorrect. They should be in labels argument. There is not edit_posts label, and you’re missing most labels. There’s many more labels you need to provide. They are listed here: https://developer.wordpress.org/reference/functions/get_post_type_labels/

Slug for custom post type

Somehow it seems WordPress sees the custom post type as posts, not pages? No, but your permalink structure (for the default post post type) that you set via the Permalink Settings admin page contains (or starts with) blog/ and by default, it will also be prepended to permalinks for custom post types, unless the post … Read more

How to query 2 custom post types that need to share a slug?

Note that a filter callback must always return something which is commonly the first parameter passed to the callback. So for example your overwriteQueryVars() function, it must always return the $query because request is a filter hook. Secondly, instead of overwriting the entire query arguments (e.g. by doing $query = array( … ) or $query->query_vars … Read more

How to add/edit advanced custom fields on custom post type’s WordPress REST API?

I think the only thing missing here is an update_callback in the call to register_rest_field. register_rest_field( ‘note’, ‘noteLink’, array( ‘get_callback’ => function(){ return get_field(‘page_link’); }, ‘update_callback’ => function( $value, $post ){ update_field(‘field_619dacfd37924’, $value, $post->ID ); } )); An important part of that according to ACF docs is using the field key to update the value … Read more