Skip to content

Commit

Permalink
Add Filter to make it possible to only add gutenberg links on a per p…
Browse files Browse the repository at this point in the history
…ost type basis (#2528)

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
  • Loading branch information
aaronjorbin authored and mtias committed Aug 28, 2017
1 parent 5cc934f commit 6884717
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6884717

Please sign in to comment.