Changeset 50127 for trunk/src/wp-includes/post-template.php
- Timestamp:
- 02/01/2021 09:20:44 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-template.php
r49977 r50127 1964 1964 echo '</ul>'; 1965 1965 } 1966 1967 /** 1968 * Retrieves the parent post object for the given post. 1969 * 1970 * @since 5.7.0 1971 * 1972 * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post. 1973 * @return WP_Post|null Parent post object, or null if there isn't one. 1974 */ 1975 function get_parent_post( $post = null ) { 1976 $wp_post = get_post( $post ); 1977 return ! empty( $wp_post->post_parent ) ? get_post( $wp_post->post_parent ) : null; 1978 } 1979 1980 /** 1981 * Returns whether the given post has a parent post. 1982 * 1983 * @since 5.7.0 1984 * 1985 * @param int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global $post. 1986 * @return bool Whether the post has a parent post. 1987 */ 1988 function has_parent_post( $post = null ) { 1989 return (bool) get_parent_post( $post ); 1990 }
Note: See TracChangeset
for help on using the changeset viewer.