简体   繁体   中英

Unable to get Custom Field Values by get_post_meta

In my wordpress post, I have a Custom Field: Message to Organizer :

When I check my wp_postmeta table, it is reflected their as:

Then when I try to use get_post_meta( $post->ID, 'Message to Organizer', true); I am getting nothing as a result. I just dont get where I am getting wrong? Please help.

It should works correctly with spaces in meta_key . So, the only thing, that could be wrong is your $post->ID value. Make sure, that $post->ID content correct value in the place, where you use the get_post_meta function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM