array_key_existsPHP检查数组里是否有这项
Published
2023-10-11
浏览次数 : 8
尤其用在wp custom meta box里面
$args = ['post_subtitle','postType','pageUrl'];
foreach ($args as $arg) {
if (array_key_exists($arg, $_POST)) {
update_post_meta( $post_id, $arg, sanitize_text_field( $_POST[$arg] ) );
}
}
- 标签1
- 标签1
- 标签1