Support » Alpha/Beta/RC » 5.0betaCompatibility for plugins that had workarounds for Gutenberg plugin

  • Resolved leodandesign

    (@leodandesign)


    Found an issue with beta5.0 installed and Gutenberg plugin disabled when using Elementor plugin. They test to see if the gutenberg_can_edit_post_type, gutenberg_init, and the_gutenberg_project functions exist and then employ a workaround for compatibility.

    I’ve implemented the following code as a workaround

    if (!function_exists('gutenberg_can_edit_post_type')) {
    
            function gutenberg_can_edit_post_type($post_type)
            {
                return true;
            }
        }
    
        if (!function_exists('gutenberg_init')) {
            function gutenberg_init()
            {
                return true;
            }
        }
        if (!function_exists('the_gutenberg_project')) {
            function the_gutenberg_project()
            {
                return true;
            }
        }

    This tests to see if the functions from the plugin exist, if they do not, then mimics them. Is there a need to mimic these functions on the release candidate to make sure plugins that have already built in compatibility with the plugin continue with the core update.

    Alternatively, please feel free to use the code as a workaround. You can see this on my WP5 Fixes Bitbucket Repo as I am updating as I find other quirks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Marius L. J.

    (@clorith)

    Hi,

    Any function prefixed with gutenberg_ will have changed names in WordPress 5.0, this has been announced for some time in various places as it’s just a development name, and not the name that will be used once the new editing experience is bundled with WordPress it self.

    If the plugin you are using relies on those functions to work, then that plugin needs to be updated.

    Thread Starter leodandesign

    (@leodandesign)

    That’s brilliant, Marius, thank you. I guess we are in the twilight zone with the beta version and the plugins not being ready, so the workaround can stay work until they do. I guess there is going to be an incredible amount of plugin update releases on launch day as the switch from the Gutenberg plugin to the new core takes place.

    Oh, that should be fun 😉

    Thanks once again for your response

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    I would recommend if ( function_exists( 'register_block_type' ) ) { } instead of anything like the_gutenberg_project – It’s actually what was recommended.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘5.0betaCompatibility for plugins that had workarounds for Gutenberg plugin’ is closed to new replies.