Changeset 58201
- Timestamp:
- 05/27/2024 09:04:10 AM (2 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-post-type.php
r57628 r58201 671 671 } 672 672 unset( $this->supports ); 673 674 675 676 677 678 679 680 681 682 683 673 684 } elseif ( false !== $this->supports ) { 674 685 // Add default features. 675 add_post_type_support( $this->name, array( 'title', 'editor' ) );686 add_post_type_support( $this->name, array( 'title', 'editor' ) ); 676 687 } 677 688 } … … 920 931 public function get_autosave_rest_controller() { 921 932 if ( ! $this->show_in_rest ) { 933 934 935 936 922 937 return null; 923 938 } -
trunk/src/wp-includes/post.php
r58200 r58201 571 571 'wp_font_family', 572 572 array( 573 'labels' 573 'labels' => array( 574 574 'name' => __( 'Font Families' ), 575 575 'singular_name' => __( 'Font Family' ), 576 576 ), 577 'public' 578 '_builtin' 579 'hierarchical' 580 'capabilities' 577 'public' => false, 578 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 579 'hierarchical' => false, 580 'capabilities' => array( 581 581 'read' => 'edit_theme_options', 582 582 'read_private_posts' => 'edit_theme_options', … … 590 590 'delete_published_posts' => 'edit_theme_options', 591 591 ), 592 'map_meta_cap' => true, 593 'query_var' => false, 594 'rewrite' => false, 595 'show_in_rest' => true, 596 'rest_base' => 'font-families', 597 'rest_controller_class' => 'WP_REST_Font_Families_Controller', 598 // Disable autosave endpoints for font families. 599 'autosave_rest_controller_class' => 'stdClass', 592 'map_meta_cap' => true, 593 'query_var' => false, 594 'rewrite' => false, 595 'show_in_rest' => true, 596 'rest_base' => 'font-families', 597 'rest_controller_class' => 'WP_REST_Font_Families_Controller', 598 'supports' => array( 'title' ), 600 599 ) 601 600 ); … … 604 603 'wp_font_face', 605 604 array( 606 'labels' 605 'labels' => array( 607 606 'name' => __( 'Font Faces' ), 608 607 'singular_name' => __( 'Font Face' ), 609 608 ), 610 'public' 611 '_builtin' 612 'hierarchical' 613 'capabilities' 609 'public' => false, 610 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 611 'hierarchical' => false, 612 'capabilities' => array( 614 613 'read' => 'edit_theme_options', 615 614 'read_private_posts' => 'edit_theme_options', … … 623 622 'delete_published_posts' => 'edit_theme_options', 624 623 ), 625 'map_meta_cap' => true, 626 'query_var' => false, 627 'rewrite' => false, 628 'show_in_rest' => true, 629 'rest_base' => 'font-families/(?P<font_family_id>[\d]+)/font-faces', 630 'rest_controller_class' => 'WP_REST_Font_Faces_Controller', 631 // Disable autosave endpoints for font faces. 632 'autosave_rest_controller_class' => 'stdClass', 624 'map_meta_cap' => true, 625 'query_var' => false, 626 'rewrite' => false, 627 'show_in_rest' => true, 628 'rest_base' => 'font-families/(?P<font_family_id>[\d]+)/font-faces', 629 'rest_controller_class' => 'WP_REST_Font_Faces_Controller', 630 'supports' => array( 'title' ), 633 631 ) 634 632 ); … … 1720 1718 * 'page-attributes', 'thumbnail', 'custom-fields', and 'post-formats'. 1721 1719 * Additionally, the 'revisions' feature dictates whether the post type 1722 * will store revisions, and the 'comments' feature dictates whether the 1723 * comments count will show on the edit screen. A feature can also be 1720 * will store revisions, the 'autosave' feature dictates whether the post type 1721 * will be autosaved, and the 'comments' feature dictates whether the 1722 * comments count will show on the edit screen. For backward compatibility reasons, 1723 * adding 'editor' support implies 'autosave' support too. A feature can also be 1724 1724 * specified as an array of arguments to provide additional information 1725 1725 * about supporting that feature. … … 2199 2199 * 2200 2200 * Additionally, the 'revisions' feature dictates whether the post type will 2201 * store revisions, and the 'comments' feature dictates whether the comments 2201 * store revisions, the 'autosave' feature dictates whether the post type 2202 * will be autosaved, and the 'comments' feature dictates whether the comments 2202 2203 * count will show on the edit screen. 2203 2204 * -
trunk/tests/phpunit/tests/post/types.php
r57987 r58201 218 218 /** 219 219 * @ticket 21586 220 220 221 */ 221 222 public function test_post_type_with_no_support() { 222 223 register_post_type( 'foo', array( 'supports' => array() ) ); 223 $this->assertTrue( post_type_supports( 'foo', 'editor' ) ); 224 $this->assertTrue( post_type_supports( 'foo', 'title' ) ); 224 $this->assertTrue( post_type_supports( 'foo', 'editor' ), 'Editor support should be enabled by default.' ); 225 $this->assertTrue( post_type_supports( 'foo', 'title' ), 'Title support should be enabled by default.' ); 226 $this->assertTrue( post_type_supports( 'foo', 'autosave' ), 'Autosaves support should be enabled by default.' ); 225 227 _unregister_post_type( 'foo' ); 226 228 227 229 register_post_type( 'foo', array( 'supports' => false ) ); 228 $this->assertFalse( post_type_supports( 'foo', 'editor' ) ); 229 $this->assertFalse( post_type_supports( 'foo', 'title' ) ); 230 $this->assertFalse( post_type_supports( 'foo', 'editor' ), 'Editor support should be disabled.' ); 231 $this->assertFalse( post_type_supports( 'foo', 'title' ), 'Title support should be disabled.' ); 232 $this->assertFalse( post_type_supports( 'foo', 'autosave' ), 'Autosaves support should be disabled.' ); 230 233 _unregister_post_type( 'foo' ); 231 234 } … … 433 436 $this->assertSameSetsWithIndex( 434 437 array( 435 'editor' => true, 436 'author' => true, 437 'title' => true, 438 'editor' => true, 439 'author' => true, 440 'title' => true, 441 'autosave' => true, 438 442 ), 439 443 $_wp_post_type_features['foo'] … … 590 594 $this->assertSameSets( array(), get_post_types_by_support( 'somefeature' ) ); 591 595 } 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 592 647 } -
trunk/tests/phpunit/tests/post/wpPostType.php
r56819 r58201 25 25 $this->assertSameSets( 26 26 array( 27 'title' => true, 28 'editor' => true, 27 'title' => true, 28 'editor' => true, 29 'autosave' => true, 29 30 ), 30 31 $post_type_supports … … 57 58 'comments' => true, 58 59 'revisions' => true, 60 59 61 ), 60 62 $post_type_supports
Note: See TracChangeset
for help on using the changeset viewer.