Changeset 52194
- Timestamp:
- 11/17/2021 03:23:40 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r52158 r52194 7643 7643 * 7644 7644 * @since 3.1.0 7645 * 7646 * @param int|WP_Post $post Post ID or post object. 7645 * @since 5.9.0 The `$post` parameter was made optional. 7646 * 7647 * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 7647 7648 * @return int|false Post parent ID (which can be 0 if there is no parent), 7648 7649 * or false if the post does not exist. 7649 7650 */ 7650 function wp_get_post_parent_id( $post ) {7651 function wp_get_post_parent_id( $post = null ) { 7651 7652 $post = get_post( $post ); 7652 7653 if ( ! $post || is_wp_error( $post ) ) { -
trunk/tests/phpunit/tests/post/wpGetPostParentId.php
r49603 r52194 34 34 } 35 35 36 /** 37 * @ticket 48358 38 * @covers ::wp_get_post_parent_id 39 */ 40 public function test_wp_get_post_parent_id_with_no_post_argument_default_to_global_post_id() { 41 $GLOBALS['post'] = get_post( self::$post_id ); 42 $this->assertSame( self::$parent_post_id, wp_get_post_parent_id() ); 43 } 44 36 45 public function test_wp_get_post_parent_id_with_non_existing_id_default_to_global_post_id() { 37 46 $GLOBALS['post'] = get_post( self::$post_id );
Note: See TracChangeset
for help on using the changeset viewer.