#25092 closed defect (bug) (fixed)
WP_Post->post_author is not INT
Reported by: | 1994rstefan | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | minor | Version: | 3.6 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
WP_Post->post_author should be a INT not a STRING.
If you have following Code
$post = get_post(123); if($post->post_author !== wp_get_current_user()->ID) echo 'Not your Post';
it will always fail (printing "Not your Post") because wp_get_current_user()->ID is (as I would expect) a INT but $post->post_author is a STRING.
The WordPress Codex and also the inline PHP Documentation says that post_author is a INT.
Attachments (1)
Change History (12)
#1
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
#2
follow-up:
↓ 3
@
11 years ago
- Keywords needs-docs added
- Resolution duplicate deleted
- Status changed from closed to reopened
The WordPress Codex and also the inline PHP Documentation says that post_author is a INT.
Don't trust the map, trust the terrain. So please fix the codex and the comments here as it looks like an documentation issue.
#3
in reply to:
↑ 2
@
11 years ago
Replying to hakre:
The WordPress Codex and also the inline PHP Documentation says that post_author is a INT.
Don't trust the map, trust the terrain. So please fix the codex and the comments here as it looks like an documentation issue.
You're welcome to fix the Codex, hakre.
I did not notice the documentation report. WP_Post's phpdoc should be changed, yes.
#5
@
11 years ago
- Keywords needs-codex added; needs-docs removed
- Milestone changed from Awaiting Review to 3.7
#6
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from reopened to closed
In 25086:
#7
@
11 years ago
- Keywords has-patch added
- Resolution fixed deleted
- Status changed from closed to reopened
25092.diff
fixes a (minor) typo that was introduced in [25086].
Duplicate of #22324. The short of it: Not going to change for now.