Making WordPress.org

Changeset 7724


Ignore:
Timestamp:
10/12/2018 01:56:08 AM (8 years ago)
Author:
dd32
Message:

Gutenberg: The latest version of Gutenberg requires access to the post locking functions, which are not available to frontenberg.
Stub these functions out, as calling the wp-admin variants of these functions seems to cause a PHP Warning (As it's not a valid post maybe?)

See https://wordpress.slack.com/archives/C02QB8GMM/p1539306717000100

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php

    r7678 r7724  
    179179
    180180    }, 11 );
    181     add_action( 'wp_enqueue_scripts', 'gutenberg_editor_scripts_and_styles' );
     181    add_action( 'wp_enqueue_scripts', function( $hook ) {
     182        // This file contains functions that gutenberg is calling.
     183        // Unfortunately they don't work great logged out and cause PHP Warnings instead.
     184        // include_once ABSPATH . 'wp-admin/includes/post.php';
     185
     186        // Stub these functions for now.
     187        function wp_check_post_lock() { return 0; }
     188        function wp_set_post_lock() { return []; }
     189
     190        gutenberg_editor_scripts_and_styles( $hook );
     191    } );
    182192
    183193    add_action( 'enqueue_block_editor_assets', function() {
Note: See TracChangeset for help on using the changeset viewer.