WordPress.org

Making WordPress.org


Ignore:
Timestamp:
07/13/2018 12:59:07 AM (14 months ago)
Author:
coreymckrill
Message:

WordCamp: Avoid fatal error when Gutenberg isn't activated

is_plugin_active is usually scoped only for WP Admin, so it may not be
available when Gutenberg Tweaks is trying to determine if Gutenberg is
activated, which would throw a fatal error. Detecting the existence of a
function within the Gutenberg plugin itself is a safer option.

Fixes #3704
Props dryanpress

File:
1 edited

Legend:

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

    r7321 r7459  
    2222 */
    2323function load() {
    24     if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
     24    /**
     25     * gutenberg_init() is only available when the Gutenberg plugin is active.
     26     */
     27    if ( function_exists( '\\gutenberg_init' ) ) {
    2528        add_filter( 'gutenberg_can_edit_post_type', __NAMESPACE__ . '\disable_gutenberg_on_cpts',           10, 2 );
    2629        add_filter( 'get_edit_post_link',           __NAMESPACE__ . '\add_classic_param_to_edit_links'            );
Note: See TracChangeset for help on using the changeset viewer.