Make WordPress Core

Ticket #33045: 33045.7.diff

File 33045.7.diff, 950 bytes (added by audrasjb, 4 years ago)

New iteration

  • src/wp-includes/post-template.php

    diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
    index 808e491349..e3a1023851 100644
    a b function wp_list_post_revisions( $post_id = 0, $type = 'all' ) { 
    19571957        echo $rows;
    19581958        echo '</ul>';
    19591959}
     1960
     1961/**
     1962 * Retrieve the parent post object.
     1963 *
     1964 * @since 5.7.0
     1965 *
     1966 * @param int|WP_Post|null $post_id Optional. Post ID or post object.
     1967 *
     1968 * @return WP_Post Parent post object.
     1969 */
     1970function get_post_parent( $post_id = null ) {
     1971        $post = get_post( $post_id );
     1972        return ! empty( $post ) ? $post : null;
     1973}
     1974
     1975/**
     1976 * Whether the post has a parent post.
     1977 *
     1978 * @since 5.7.0
     1979 *
     1980 * @param int|WP_Post|null $post_id Optional. Post ID or post object.
     1981 *
     1982 * @return bool True is the post has a parent post, false otherwise.
     1983 */
     1984function has_post_parent( $post_id = null ) {
     1985        return (bool) get_post_parent( $post_id );
     1986}