Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7d192d8
Initial commit.
ramonjd Nov 23, 2023
d7b4c1c
Adding title to schema.
ramonjd Nov 23, 2023
41c98a5
Remove permissions checks and favour parent's
ramonjd Nov 23, 2023
59d6953
Remove duplicated tests
ramonjd Nov 23, 2023
dbcc3b5
Reverting post type registration changes as it assigns an autosave co…
ramonjd Nov 23, 2023
25cbe83
Regenerated fixture
ramonjd Nov 23, 2023
e9d1f10
Revert introducing title in schema
ramonjd Nov 23, 2023
ec4229f
Reinstating global styles revision controller tests that were duplica…
ramonjd Jan 3, 2024
ca524b2
Update src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles…
ramonjd Dec 22, 2023
93190ae
Excluding search, include and exclude from the collection query params
ramonjd Jan 3, 2024
b43344d
Now that https://github.com/WordPress/wordpress-develop/pull/5655 has…
ramonjd Jan 31, 2024
dac8e0b
Pulling across changes from https://github.com/WordPress/wordpress-de…
ramonjd Feb 7, 2024
acd2590
Implementing latest round of feedback:
ramonjd Feb 8, 2024
dfa02f8
Apply suggestions from code review
spacedmonkey Feb 13, 2024
f6f45e3
Fix lints
jonnynews Feb 13, 2024
038331b
Remove ideas
jonnynews Feb 13, 2024
6c7a149
Merge branch 'trunk' into update/global-styles-revision-extends-revis…
jonnynews Feb 13, 2024
95db1e9
Fix
jonnynews Feb 13, 2024
9fb3e30
Add allow_batch parameter.
jonnynews Feb 13, 2024
319bdff
Be overly safe with `__construct` method.
jonnynews Feb 13, 2024
095c7d0
Apply suggestions from code review
spacedmonkey Feb 13, 2024
1fef997
Add 'allow_batch' option to API endpoints in WP API
jonnynews Feb 13, 2024
70d68da
Update version annotations for wp_global_styles related changes
spacedmonkey May 20, 2024
c62fed9
Simplify unset function calls in global styles revisions controller
spacedmonkey May 20, 2024
cc916ac
Merge branch 'trunk' into update/global-styles-revision-extends-revis…
spacedmonkey May 23, 2024
7c526bd
Disable autosave for global styles in WordPress
spacedmonkey May 23, 2024
fe4fc65
Remove redundant comment in wp-post-type.php
spacedmonkey May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Disable autosave for global styles in WordPress
The commit disables the autosave endpoints for the global styles in WordPress. Modifications were made to both post.php and class-wp-post-type.php to prevent autosave for the 'wp_global_styles' post type. This ensures that global Styles does not trigger unnecessary autosaves.
  • Loading branch information
spacedmonkey committed May 23, 2024
commit 7c526bd178cde4fa54a7a22dcefeecf0599c971c
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ public function get_autosave_rest_controller() {
return null;
}

if ( in_array( $this->name, array( 'attachment', 'wp_global_styles' ), true ) ) {
if ( 'attachment' === $this->name ) {
return null;
}

Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ function create_initial_post_types() {
'rest_base' => 'global-styles',
'rest_controller_class' => 'WP_REST_Global_Styles_Controller',
'revisions_rest_controller_class' => 'WP_REST_Global_Styles_Revisions_Controller',
// Disable autosave endpoints for global styles.
'autosave_rest_controller_class' => 'stdClass',
Comment on lines +490 to +491
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this, add remove_post_type_support( 'wp_global_styles', 'autosave' ) below.

'late_route_registration' => true,
'capabilities' => array(
'read' => 'edit_theme_options',
Expand Down