From 4cfc60ed8dcb5a124e91b583ec60e5c6df8e4d72 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Thu, 24 Aug 2017 12:43:57 -0400 Subject: [PATCH] Add Filter to make it possible to only add gutenberg links on a per post type basis Right now, Gutenberg is not the right experience for all post types. In order to help encourage testing, we should make it possible to remove the quick action from certain post types. See: https://meta.trac.wordpress.org/ticket/3065#comment:5 --- lib/register.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/register.php b/lib/register.php index cf16006d64b22..86f0b44e20f47 100644 --- a/lib/register.php +++ b/lib/register.php @@ -90,8 +90,9 @@ function gutenberg_add_edit_links_filters() { function gutenberg_add_edit_links( $actions, $post ) { $can_edit_post = current_user_can( 'edit_post', $post->ID ); $title = _draft_or_post_title( $post->ID ); + $post_type = get_post_type( $post ); - if ( $can_edit_post && 'trash' !== $post->post_status ) { + if ( $can_edit_post && 'trash' !== $post->post_status && apply_filters( 'gutenberg_add_edit_link_for_post_type', true, $post_type, $post ) ) { // Build the Gutenberg edit action. See also: WP_Posts_List_Table::handle_row_actions(). $gutenberg_url = menu_page_url( 'gutenberg', false ); $gutenberg_action = sprintf(