Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检查有多少自定义字段有帖子,我不想检索任何值,但我需要找出有多少自定义字段有帖子。
<?php // get only the keys as you only need the number $cfields = get_post_custom_keys($post_id); // num_cfields will store the number of custom fields $num_cfields = count($cfields); ?>
还有get_post_custom和get_post_custom_values