Make WordPress Core


Ignore:
Timestamp:
05/27/2024 09:04:10 AM (12 months ago)
Author:
swissspidy
Message:

Posts, Post Types: Autosave: Allow disabling autosave support per post type.

Not all post types support autosaving. By making autosave a post type feature, support can be more granularly handled without any workarounds or hardcoded allowlists. wp_font_family and wp_font_face are examples of built-in post types which do not support autosave.

For backward compatibility reasons, adding editor support implies autosave support, so one would need to explicitly use remove_post_type_support() to remove it again.

Props swissspidy, youknowriad, hellofromtonya, peterwilsoncc.
Fixes #41172.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/wpPostType.php

    r56819 r58201  
    2525        $this->assertSameSets(
    2626            array(
    27                 'title'  => true,
    28                 'editor' => true,
     27                'title'    => true,
     28                'editor'   => true,
     29                'autosave' => true,
    2930            ),
    3031            $post_type_supports
     
    5758                'comments'  => true,
    5859                'revisions' => true,
     60                'autosave'  => true,
    5961            ),
    6062            $post_type_supports
Note: See TracChangeset for help on using the changeset viewer.