Changeset 53771
- Timestamp:
- 07/24/2022 01:24:44 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r53751 r53771 4160 4160 * For new posts check the primitive capability, for updates check the meta capability. 4161 4161 */ 4162 $post_type_object = get_post_type_object( $post_type ); 4163 4164 if ( ! $update && 'pending' === $post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) { 4165 $post_name = ''; 4166 } elseif ( $update && 'pending' === $post_status && ! current_user_can( 'publish_post', $post_ID ) ) { 4167 $post_name = ''; 4162 if ( 'pending' === $post_status ) { 4163 $post_type_object = get_post_type_object( $post_type ); 4164 4165 if ( ! $update && $post_type_object && ! current_user_can( $post_type_object->cap->publish_posts ) ) { 4166 $post_name = ''; 4167 } elseif ( $update && ! current_user_can( 'publish_post', $post_ID ) ) { 4168 $post_name = ''; 4169 } 4168 4170 } 4169 4171 -
trunk/tests/phpunit/tests/post.php
r53559 r53771 503 503 504 504 /** 505 * @ticket 55877 506 * @covers ::wp_insert_post 507 */ 508 public function test_wp_insert_post_should_not_trigger_warning_for_pending_posts_with_unknown_cpt() { 509 $post_id = wp_insert_post( 510 array( 511 'post_title' => 'title', 512 'post_type' => 'unknown', 513 'post_status' => 'pending', 514 ) 515 ); 516 517 $this->assertIsNumeric( $post_id ); 518 $this->assertGreaterThan( 0, $post_id ); 519 } 520 521 /** 505 522 * @ticket 20451 506 523 */
Note: See TracChangeset
for help on using the changeset viewer.