Make WordPress Core

Changeset 58211


Ignore:
Timestamp:
05/27/2024 03:22:05 PM (6 months ago)
Author:
swissspidy
Message:

Posts, Post Types: Remove now obsolete hardcoded attachment check for autosave support.

Follow-up to [58201].

Props swissspidy, spacedmonkey.
See #41172.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post-type.php

    r58201 r58211  
    935935
    936936        if ( ! post_type_supports( $this->name, 'autosave' ) ) {
    937             return null;
    938         }
    939 
    940         if ( 'attachment' === $this->name ) {
    941937            return null;
    942938        }
  • trunk/tests/phpunit/tests/post/types.php

    r58201 r58211  
    599599     */
    600600    public function test_post_type_supports_autosave_based_on_editor_support() {
     601        $this->assertFalse( post_type_supports( 'attachment', 'autosave' ) );
     602
    601603        register_post_type( 'foo', array( 'supports' => array( 'editor' ) ) );
    602604        $this->assertTrue( post_type_supports( 'foo', 'autosave' ) );
  • trunk/tests/phpunit/tests/post/wpPostType.php

    r58201 r58211  
    370370    /**
    371371     * @ticket 56922
     372     * @ticket 41172
    372373     *
    373374     * @covers WP_Post_Type::get_autosave_rest_controller
     
    412413            'disable show_in_rest'               => array(
    413414                false,
    414                 'attachment',
    415                 false,
    416                 null,
    417             ),
    418             'invalid post type'                  => array(
    419                 true,
    420                 'attachment',
     415                'test_post_type',
    421416                false,
    422417                null,
Note: See TracChangeset for help on using the changeset viewer.