Changeset 62168
- Timestamp:
- 03/27/2026 10:46:01 PM (11 hours ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/post.php (modified) (1 diff)
-
tests/phpunit/tests/admin/exportWp.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r62075 r62168 688 688 'show_in_rest' => false, 689 689 'show_ui' => false, 690 'can_export' => false, 690 691 'supports' => array( 'custom-fields' ), 691 692 ) -
trunk/tests/phpunit/tests/admin/exportWp.php
r61405 r62168 475 475 $this->assertGreaterThan( 0, count( $xml->channel->item ), 'Export should contain items' ); 476 476 } 477 478 /** 479 * Ensure that posts types with 'can_export' set to false are not included in the export. 480 * 481 * @ticket 64964 482 */ 483 public function test_export_does_not_include_excluded_post_types() { 484 register_post_type( 485 'wpexport_excluded', 486 array( 'can_export' => false ) 487 ); 488 489 $excluded_post_id = self::factory()->post->create( 490 array( 491 'post_title' => 'Excluded Post Type', 492 'post_type' => 'wpexport_excluded', 493 'post_status' => 'publish', 494 ) 495 ); 496 497 $xml = $this->get_the_export( 498 array( 499 'content' => 'all', 500 ) 501 ); 502 503 $found_post = false; 504 foreach ( $xml->channel->item as $item ) { 505 $wp_item = $item->children( 'wp', true ); 506 if ( (int) $wp_item->post_id === $excluded_post_id ) { 507 $found_post = true; 508 break; 509 } 510 } 511 512 $this->assertFalse( $found_post, 'Posts of excluded post types should not be included in export' ); 513 } 477 514 }
Note: See TracChangeset
for help on using the changeset viewer.