#42797 closed defect (bug) (fixed)
Add missing parameter description in wp_get_post_parent_id function DocBlock
| Reported by: | keesiemeijer | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.1 |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | docs |
Description
The wp_get_post_parent_id function accepts a post ID or a post object to get the parent post id and it defaults to the global post object.
Because the parameter is called $post_ID It needs to be updated to $post
Attachments (2)
Change History (9)
#1
@
9 years ago
- Keywords has-patch has-unit-tests added
In patch 42797.patch the $post_ID parameter is renamed to $post and the description is added. I've added unit tests to see if the original code and new code return the same parent post ids.
#5
@
9 years ago
- Resolution fixed
- Status closed → reopened
Reopening this because the unit tests are not of an acceptable quality:
- Shared fixtures should be used whenever possible. The test suite is already slow, and we should keep it from getting slower unnecessarily.
- The global
$postis an instance ofWP_Post, and not an integer (post id).
Two smaller improvements:
assertSame()should be preferred, because the checks are stricter.assertInstanceOf()is a shorter way to determine the type of an object.
Also the global $post gets reset after every test, so no need to do it manually.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Add missing param description and rename $post_ID to $post