[wp-trac] [WordPress Trac] #20752: get_post_meta() accepts int as string value only
WordPress Trac
wp-trac at lists.automattic.com
Fri May 25 22:18:30 UTC 2012
#20752: get_post_meta() accepts int as string value only
--------------------------+-----------------------------
Reporter: marcella1981 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.4
Severity: normal | Keywords:
--------------------------+-----------------------------
With custom fields with keys
{{{
custom_field_0
custom_field_1
custom_field_2
}}}
Grabbing the data as follows is fine
{{{
$field[] = get_post_meta(get_the_ID(), 'custom_field_0');
$field[] = get_post_meta(get_the_ID(), 'custom_field_1');
$field[] = get_post_meta(get_the_ID(), 'custom_field_2');
}}}
Return: Field value
However
{{{
for($i = 1; $i <= 3; $i++) :
$field[] = get_post_meta(get_the_ID(), 'custom_field_'.$i);
endforeach;
}}}
Return: null
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20752>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list