You are using get_post_meta incorrectly, so it is returning FALSE every time. As PHP equates ‘0’ and FALSE, your div will always be displayed.
The correct syntax for get_post_meta is:
<?php $meta_values = get_post_meta($post_id, $key, $single); ?>
where $post_id is the only required argument.
Related Posts:
- How to break meta values into different items and avoid duplicates?
- How to wrap meta values seperated by comma in ? [closed]
- Run a check for multiple meta key values
- How to create a shortcode to print specific values stored in a post meta array?
- shortcode in a custom metabox
- Update post meta custom field using block editor
- Set class if a meta value is set within post archive
- Create Shortcode shows only posts with custom_field meta
- Using ACF Custom Field value in a URL with do_shortcode() [closed]
- Custom Field: Display only if a specific key is selected outside the loop
- Display meta data from a custom field within plugin Category Grid View Gallery
- Retrieving custom field as shortcode
- WP Query Args – search by meta_key or title
- Saving multiple custom meta box fields
- get Custom field label (select/dropdown) on front end
- Best way to programmatically remove a category/term from a post
- When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
- Storing meta fields multiple times OR once with multi dimensional array?
- display specific custom fields
- Add new “Insert Into Post” button with another function
- Is it possible to store arrays in a custom field?
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- importing data from non-wordpress mysql db
- Call a custom field in an audio shortcode?
- Assign/update the custom field value for all posts
- Create meta boxes that don’t show in custom fields
- Transients vs CRON +Custom Fields: Caching Data Per Post
- Unable to save datetime custom meta field using update_post_meta() function
- Create custom field on post draft or publish?
- wp_editor in add_meta_boxes does not show gallery
- get_post_meta fields don’t show up on posts page
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Add a post meta key and value only if it does not exist on the post
- Order posts according to user defined order for meta values?
- Displaying posts with only upcoming dates according their custom field date value
- Function to change meta value in database for each post
- Get a post_id where meta_value equals something in a serialized meta_value field
- Get aggregate list of all custom fields for entire blog
- trim custom field text value and show (…)
- using multiple meta_key and meta_value in query_posts
- How can I sort homepage by a meta value?
- Get specific custom field keys from a post and put into an array
- MySQL Query that looks for post with Custom Field, then changes Category
- ACF: How to get the full field name (meta_key) by a field key?
- filtering custom post types via meta data drop down
- How to add a new meta key and assign timestamp to posts
- If meta key exists in get posts function otherwise create it
- Filter by custom field (meta_key) using JSON API
- Should custom meta boxes be able to output shortcodes the same as WordPress’ native post editor?
- Read / Watch / Listen times – meta
- How do I Implement Atomic Update of Post Metadata?
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- modify wordpress caption shortcode
- Why is my Custom Meta Box Field Inputs NOT saving?
- Get registered custom fields or post meta even if empty
- Displaying multiple URLs as custom field values
- Stop sending email everytime I updates my post
- Best way to store everyday post views?
- Unable to get specific value from post meta
- pre_get_posts : only get posts by wp_usermeta value
- Problem with saving large amount of data in postmeta/usermeta
- Custom meta is not being saved
- How to get posts with a metadata numeric key greater than X?
- meta_value and meta_key filtering returning no posts [closed]
- How do i get the attached images with custom value checked?
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- Display posts with empty custom field
- How to call a post’s metadata in shortcode.php?
- query_posts with meta_value
- do_shortcode close
- If metabox has content display content
- updating one custom meta field only
- Footnotes in custom fields
- Create a new custom field for all posts based on current custom field
- Display Meta Data with HTML?
- wordpress get_post_meta / the_meta to output custom field value
- Custom Query: query by post custom meta data
- Group Posts By Custom Meta Value: Date
- Meta field bulk editing no longer working in WP 6.0 [closed]
- update_post_meta not working well
- User query – getting values for custom meta keys/fields
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Can’t set custom meta fields for a post
- Allow HTML in Custom Metabox area
- Custom field metabox not showing in back-end
- Save, update, get and sanitize post meta as HTML not plain
- WooCommerce 3 get custom variation on process order [closed]
- Output Custom Field value to shortcode
- Saved Post Meta Array Returns as String
- Query Multiple meta
- Problem saving meta data
- Query postmeta values, and return multiple post_titles for common meta value
- change attachment custom field onChange event
- Running a Gallery Shortcode in a Custom Fields Widget
- Make Custom Fields Public in JSON – API
- Shortcode not picking up custom field
- Order by a meta field in query loop
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Search for meta_query does not return any result if combined with title