Make WordPress Core

Ticket #33045: 33045.6.patch

File 33045.6.patch, 824 bytes (added by ramiy, 5 years ago)
  • wp-includes/post-template.php

     
    19441944        echo $rows;
    19451945        echo '</ul>';
    19461946}
     1947
     1948/**
     1949 * Retrieve the parent post ID.
     1950 *
     1951 * @since 5.3.0
     1952 *
     1953 * @param int|WP_Post|null $post_id Optional. Post ID or post object.
     1954 *
     1955 * @return int
     1956 */
     1957function get_post_parent( $post_id = null ) {
     1958        $post = get_post( $post_id );
     1959        return ! empty( $post ) ? $post->post_parent : 0;
     1960}
     1961
     1962/**
     1963 * Whether the post has a parent post.
     1964 *
     1965 * @since 5.3.0
     1966 *
     1967 * @param int|WP_Post|null $post_id Optional. Post ID or post object.
     1968 *
     1969 * @return int
     1970 */
     1971function has_post_parent( $post_id = null ) {
     1972        return (bool) get_post_parent( $post_id );
     1973}