Making WordPress.org

Changeset 8567


Ignore:
Timestamp:
04/02/2019 08:24:30 PM (6 years ago)
Author:
vedjain
Message:

WordCamp: Disable block editor for wordcamp post type due to incompatibility

In block editor flow, when an organizer who do not have permission to change status, but are author of the post, tries to edit a WordCamp post, "Publish" button gets replaced with "Submit for Review" button. Since we do not support review flow for WordCamp Post Type, this has unintended consequences which includes post status being set to "Needs Vetting", there by accidentally changing WordCamp Status.

File:
1 edited

Legend:

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

    r8026 r8567  
    1717    return $defaults;
    1818}
     19
     20/**
     21 * Disable block editor for WordCamp post types, since its not fully compatible yet.
     22 * In block editor flow, when an organizer who do not have permission to change status, but are author of the post, tries to edit a WordCamp post, "Publish" button gets replaced with "Submit for Review" button.
     23 * Since we do not support review flow for WordCamp Post Type, this has unintended consequences which includes post status being set to "Needs Vetting", there by accidentally changing WordCamp Status.
     24 *
     25 * @param string $status
     26 * @param string $post_type
     27 *
     28 * @return bool
     29 */
     30function disable_block_editor_for_wordcamp( $use_block_editor, $post_type ) {
     31    return $use_block_editor && WCPT_POST_TYPE_ID !== $post_type;
     32}
     33
     34add_filter( 'use_block_editor_for_post_type', __NAMESPACE__ . '\disable_block_editor_for_wordcamp', 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.