I have made a Custom Post Type called cargo using CPT UI. I have thereafter added several custom fields (port_of_loading, volume, etc) using Advanced Customs field. I have populated the CPT / fields with a few records.
In my template, I have the following code:
$args = array(
'post_type' => 'cargo',
'post_per_page' => '12',
);
$cargo = new WP_Query($args);
echo '<pre>';
var_dump($cargo);
echo '</pre>';
if ($cargo->have_posts()) {
while ( $cargo->have_posts()) : $cargo->the_post() ;
echo 'Some cargo'.'<.br>';
get_field('volume');
endwhile;
}
Why can't I see the field names in the var_dump from the postmeta table? I can see field value when I echo them though.
WP_Query不知道Advanced Custom字段的键名 ,此类返回WP_Posts数组(Wordpress核心类),Advanced Custom字段是第三方插件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.