开发者

Custom field data not showing on custom post type single

开发者 https://www.devze.com 2023-01-07 18:41 出处:网络
I have the following on a custom type: <?php if (get_post_meta($post->ID, \'client_value\', true)) { ?><span><?php echo get_post_meta($post->ID, \"client_value\", true); ?><

I have the following on a custom type:

<?php if (get_post_meta($post->ID, 'client_value', true)) { ?><span><?php echo get_post_meta($post->ID, "client_value", true); ?></span><?php } ?>

There is data in client_value but it's not showing on my custom type, it w开发者_JS百科orks fine on general posts, just not on custom types. Any ideas why?


Are you positive that for the custom post type in question, there is definitely a meta entry in the database under the key 'client_value' that matches the post ID?

Whereabouts are you calling this code? Have you tried printing out the contents of $post?

0

精彩评论

暂无评论...
验证码 换一张
取 消