WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/20/2021 05:43:55 PM (8 months ago)
Author:
johnbillion
Message:

Posts, Post Types: Rename the new post parent conditional tag functions for clarity.

  • get_parent_post() becomes get_post_parent()
  • has_parent_post() becomes has_post_parent()

Props johnjamesjacoby, SergeyBiryukov, lukecarbis, peterwilsoncc

Fixes #33045

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r50127 r50396  
    19731973 * @return WP_Post|null Parent post object, or null if there isn't one.
    19741974 */
    1975 function get_parent_post( $post = null ) {
     1975function get_post_parent( $post = null ) {
    19761976    $wp_post = get_post( $post );
    19771977    return ! empty( $wp_post->post_parent ) ? get_post( $wp_post->post_parent ) : null;
     
    19861986 * @return bool Whether the post has a parent post.
    19871987 */
    1988 function has_parent_post( $post = null ) {
    1989     return (bool) get_parent_post( $post );
    1990 }
     1988function has_post_parent( $post = null ) {
     1989    return (bool) get_post_parent( $post );
     1990}
Note: See TracChangeset for help on using the changeset viewer.