[wp-trac] [WordPress Trac] #25092: WP_Post->post_author is not INT
WordPress Trac
noreply at wordpress.org
Tue Aug 20 12:13:07 UTC 2013
#25092: WP_Post->post_author is not INT
--------------------------+-----------------------------
Reporter: 1994rstefan | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.6
Severity: minor | Keywords:
--------------------------+-----------------------------
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25092>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list