HEX
Server: nginx/1.28.1
System: Linux VM-0-12-opencloudos 6.6.117-45.oc9.x86_64 #1 SMP Thu Dec 4 10:26:39 CST 2025 x86_64
User: www (1000)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/lib/experimental/rest-api-overrides.php
<?php
/**
 * Boot package REST API overrides.
 *
 * @package gutenberg
 */

/**
 * Allow auto-draft status in WordPress REST API for all post types.
 *
 * By default, WordPress REST API doesn't include 'auto-draft' in the
 * allowed status values. This function adds it to the schema enum for
 * all eligible post types.
 */
function gutenberg_boot_allow_auto_draft_in_rest_api() {
	$auto_draft_filter = function ( $schema ) {
		if ( isset( $schema['properties']['status']['enum'] ) ) {
			$schema['properties']['status']['enum'][] = 'auto-draft';
		}
		return $schema;
	};

	// Get post types that should support auto-draft.
	$post_types = get_post_types(
		array(
			'show_in_rest' => true,
			'show_ui'      => true,
		),
		'objects'
	);

	foreach ( $post_types as $post_type ) {
		$supports_editor   = post_type_supports( $post_type->name, 'editor' );
		$supports_title    = post_type_supports( $post_type->name, 'title' );
		$is_wp_core_system = strpos( $post_type->name, 'wp_' ) === 0;
		$is_attachment     = 'attachment' === $post_type->name;

		// Only add auto-draft to content post types:
		// - Must support either editor or title (content editing capabilities).
		// - Exclude WordPress core system types (wp_block, wp_navigation, etc.).
		// - Exclude attachments (media files don't need auto-draft status).
		$should_support_auto_draft = ( $supports_editor || $supports_title ) &&
									! $is_wp_core_system &&
									! $is_attachment;

		if ( $should_support_auto_draft ) {
			add_filter( "rest_{$post_type->name}_item_schema", $auto_draft_filter );
		}
	}
}

add_action( 'rest_api_init', 'gutenberg_boot_allow_auto_draft_in_rest_api' );