Making WordPress.org

Changeset 5944


Ignore:
Timestamp:
09/20/2017 10:22:56 PM (7 years ago)
Author:
coreymckrill
Message:

WordCamp: Limit Gutenberg edit links to posts and pages

See #3065

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-misc.php

    r5521 r5944  
    276276    return $options;
    277277});
     278
     279/**
     280 * Limit which post types get a Gutenberg edit link.
     281 *
     282 * Many of WordCamp.org's CPTs make extensive use of meta boxes. Since these are not currently supported in the
     283 * Gutenberg editor, this limits the Gutenberg content editing links to posts and pages.
     284 *
     285 * TODO: revisit this when Gutenberg supports meta boxes.
     286 */
     287add_filter( 'gutenberg_add_edit_link_for_post_type', function( $bool, $post_type ) {
     288    $allowed_post_types = array(
     289        'post',
     290        'page',
     291    );
     292
     293    if ( ! in_array( $post_type, $allowed_post_types, true ) ) {
     294        return false;
     295    }
     296
     297    return $bool;
     298}, 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.