'; /* translators: %s: Minimum required version */ printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.2.0' ); echo '

'; deactivate_plugins( array( 'gutenberg/gutenberg.php' ) ); } /** * Display a build notice. * * @since 0.1.0 */ function gutenberg_build_files_notice() { echo '

'; _e( 'Gutenberg development mode requires files to be built. Run npm install to install dependencies, npm run build to build the files or npm run dev to build the files and watch for changes. Read the contributing file for more information.', 'gutenberg' ); echo '

'; } /** * Verify that we can initialize the Gutenberg editor , then load it. * * @since 1.5.0 */ function gutenberg_pre_init() { global $wp_version; if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( dirname( __FILE__ ) . '/build/blocks' ) ) { add_action( 'admin_notices', 'gutenberg_build_files_notice' ); return; } // Get unmodified $wp_version. include ABSPATH . WPINC . '/version.php'; // Strip '-src' from the version string. Messes up version_compare(). $version = str_replace( '-src', '', $wp_version ); if ( version_compare( $version, '5.2.0', '<' ) ) { add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' ); return; } require_once dirname( __FILE__ ) . '/lib/load.php'; } /** * Outputs a WP REST API nonce. */ function gutenberg_rest_nonce() { exit( wp_create_nonce( 'wp_rest' ) ); } add_action( 'wp_ajax_gutenberg_rest_nonce', 'gutenberg_rest_nonce' );