From c25de87961ce6b27fc7c9efc6c0a8dc7eedeebb9 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Wed, 25 Oct 2017 13:47:21 -0700 Subject: [PATCH] Restore `gutenberg_add_edit_link_for_post_type` filter. This was added in 6884717, but then removed in bdf94e6. It's being added back because Gutenberg does not yet have support for advanced meta boxes, which many custom post types rely on. Gutenberg should not be the default editor for post types which it does not fully support, because that leads to a poor user experience. --- gutenberg.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index 3a93cfd2c9110..3a3d8391d1251 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -147,7 +147,7 @@ function gutenberg_init( $return, $post ) { return false; } - if ( ! post_type_supports( $post_type, 'editor' ) ) { + if ( ! post_type_supports( $post_type, 'editor' ) || ! apply_filters( 'gutenberg_add_edit_link_for_post_type', true, $post_type, $post ) ) { return false; } @@ -349,7 +349,8 @@ function gutenberg_add_edit_link_filters() { * @return array Updated post actions. */ function gutenberg_add_edit_link( $actions, $post ) { - if ( 'trash' === $post->post_status || ! post_type_supports( $post->post_type, 'editor' ) ) { + $post_type_supported = post_type_supports( $post->post_type, 'editor' ) && apply_filters( 'gutenberg_add_edit_link_for_post_type', true, $post->post_type, $post ); + if ( 'trash' === $post->post_status || ! $post_type_supported ) { return $actions; }