admin管理员组文章数量:1291089
How to print array values for custom field meta.
My code -
<?php $item = get_post_meta($post->ID, 'occupationalCategory', false); ?>
<?php print_r( $item[0]['occupationalCategory'] ); ?>;
<?php print_r( $item[1]['occupationalCategory'] ); ?>
Output - none
How to print array values for custom field meta.
My code -
<?php $item = get_post_meta($post->ID, 'occupationalCategory', false); ?>
<?php print_r( $item[0]['occupationalCategory'] ); ?>;
<?php print_r( $item[1]['occupationalCategory'] ); ?>
Output - none
Share Improve this question asked Jun 2, 2021 at 17:49 PuneetPuneet 477 bronze badges 2 |1 Answer
Reset to default 1Based on the screenshot I assumed is var_dump of your $item The code should look like
<?php $item = get_post_meta($post->ID, 'occupationalCategory', false); ?>
<?php print_r( $item['occupationalCategory'][0] ); ?>;
<?php print_r( $item['occupationalCategory'][1] ); ?>
$item contains array, with a element which key is 'occupationalCategory', this element points to other array with two elements
本文标签: customizationHow to print Array values of custom Fields Meta
版权声明:本文标题:customization - How to print Array values of custom Fields Meta? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741524771a2383400.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
US, 29.622, TX
because the array is not print with updated code. – Puneet Commented Jun 5, 2021 at 17:02