| @@ -8,21 +8,22 @@ | ||
| 8 | 8 | /** |
| 9 | 9 | * Overrides the default REST controller for autosaves to fix real-time |
| 10 | 10 | * collaboration on draft posts. |
| 11 | 11 | * |
| 12 | - * When RTC is enabled, draft autosaves from all users update the post directly | |
| 13 | - * instead of creating per-user autosave revisions depending on post lock and | |
| 14 | - * assigned author. | |
| 12 | + * When RTC is enabled, regular draft autosaves are stored as revisions instead | |
| 13 | + * of updating the parent post based on its lock and author. Auto-drafts are | |
| 14 | + * still promoted to drafts. | |
| 15 | 15 | * |
| 16 | - * Only overrides when autosave_rest_controller_class is not explicitly set, | |
| 17 | - * i.e. when WP_REST_Autosaves_Controller would be used by default. Post types | |
| 18 | - * with their own specialized autosave controller (e.g. templates) are left alone. | |
| 16 | + * Only overrides when RTC is enabled and autosave_rest_controller_class is not | |
| 17 | + * explicitly set, i.e. when WP_REST_Autosaves_Controller would be used by | |
| 18 | + * default. Post types with their own specialized autosave controller (e.g. | |
| 19 | + * templates) are left alone. | |
| 19 | 20 | * |
| 20 | 21 | * @param array $args Array of arguments for registering a post type. |
| 21 | 22 | * @return array Modified array of arguments. |
| 22 | 23 | */ |
| 23 | 24 | function gutenberg_override_autosaves_rest_controller( $args ) { |
| 24 | - if ( empty( $args['autosave_rest_controller_class'] ) ) { | |
| 25 | + if ( empty( $args['autosave_rest_controller_class'] ) && wp_is_collaboration_enabled() ) { | |
| 25 | 26 | $args['autosave_rest_controller_class'] = 'Gutenberg_REST_Autosaves_Controller'; |
| 26 | 27 | } |
| 27 | 28 | return $args; |
| 28 | 29 | } |