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/tests/phpunit/tests/post/template.php

    r50127 r50396  
    468468
    469469        // Test if child get_parent_post() post returns Null by default.
    470         $parent = get_parent_post( $child_id );
     470        $parent = get_post_parent( $child_id );
    471471        $this->assertNull( $parent );
    472472
     
    480480
    481481        // Test if child get_parent_post() post returns the parent object.
    482         $parent = get_parent_post( $child_id );
     482        $parent = get_post_parent( $child_id );
    483483        $this->assertNotNull( $parent );
    484484        $this->assertSame( $parent_id, $parent->ID );
     
    499499
    500500        // Test if child has_parent_post() post returns False by default.
    501         $parent = has_parent_post( $child_id );
     501        $parent = has_post_parent( $child_id );
    502502        $this->assertFalse( $parent );
    503503
     
    511511
    512512        // Test if child has_parent_post() returns True.
    513         $parent = has_parent_post( $child_id );
     513        $parent = has_post_parent( $child_id );
    514514        $this->assertTrue( $parent );
    515515    }
Note: See TracChangeset for help on using the changeset viewer.