我在post meta中保存了一组数据,现在我需要获取meta并将其用作其他项目。我的代码不工作,请帮我更正,谢谢!
$boxes = Array( \'height\', \'width\' );
foreach ( $boxes as $data ){
$project = get_post_meta($post->ID, $data, true);
}
$item_a = $project->height;
$item_b = $project->width;
我在post meta中保存了一组数据,现在我需要获取meta并将其用作其他项目。我的代码不工作,请帮我更正,谢谢!
$boxes = Array( \'height\', \'width\' );
foreach ( $boxes as $data ){
$project = get_post_meta($post->ID, $data, true);
}
$item_a = $project->height;
$item_b = $project->width;
foreach ($boxes as $data) {
$project[$data] = get_post_meta($post->ID, $data, true);
}
$item_a = $project[\'height\'];
$item_b = $project[\'width\'];