如何检查WordPress数据库中是否存在后置元键


Answers:



2

您可以使用get_post_custom(POST ID GOES HERE),它将返回包含特定帖子或页面的所有自定义字段的多维数组。

所以像:

$meta_data = get_post_custom(785);
if ($meta_data['my_meta_key'][0] != "")
    ...

将允许您检查特定的meta_key是否为空。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.