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
- SQL query based on two different custom field values
- Block Editor – Meta values not saved, meta changes to empty array on update
- Can I exclude a post by meta key using pre_get_posts function?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Max length of meta_value
- Custom post meta field effect on the performance on the post
- How to get custom post meta using REST API
- Difference between meta keys with _ and without _ [duplicate]
- Orderby meta_value only returns posts that have existing meta_key
- What is the index [0] for on post meta fields?
- What is “meta_input” parameter in wp_insert_post() used for?
- How to enable revisions for post meta data?
- The “_encloseme” Meta-Key Conundrum
- Best way to programmatically remove a category/term from a post
- Using get_post_meta with new_to_publish
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- Custom field metabox not showing in back-end
- So much data in postmeta
- explode array within shortcode
- Can I count the number of users matching a value in a multiple value key?
- Change behavior of “Insert into Post” based on attachment metadata
- When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?
- How to hide meta box values from custom fields list?
- Auto sort the wp-admin post list by a meta key
- get_post_meta() unserialize issue – returns boolean(false)
- What is the advantage of the wp_options design pattern?
- Storing meta fields multiple times OR once with multi dimensional array?
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- Update all posts automatically when using post_meta
- Allow user to create instances of custom field
- display specific custom fields
- Add new “Insert Into Post” button with another function
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- get_pages sort alphabetically by meta value
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- passing argument to get_template_part() or a better way to code
- Is it possible to store arrays in a custom field?
- Get updated meta data after save_post hook
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- Save HTML formatted data to post meta using add_post_meta()
- importing data from non-wordpress mysql db
- Call a custom field in an audio shortcode?
- Assign/update the custom field value for all posts
- Order by custom field date with ASC order
- 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
- Up/Down voting system for WordPress
- post meta data clearing on autosave
- Create custom field on post draft or publish?
- Display info from custom fields in all images’ HTML
- wp_editor in add_meta_boxes does not show gallery
- Ordering posts by anniversary using only day and month
- get_post_meta fields don’t show up on posts page
- Update meta values with AJAX
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- ajax delete value from custom field array
- Save attachment custom fields on front end
- Custom field for default gallery
- How to use pagination with get_post_meta
- Copying Custom Meta Values from existing post to a duplicate post
- Add a post meta key and value only if it does not exist on the post
- WP_query : meta_key with custom rule for specific value
- Move value of one custom field to another
- Order posts according to user defined order for meta values?
- Displaying posts with only upcoming dates according their custom field date value
- Execute/Parse Shortcode in Native WordPress Custom Field Value Field
- Custom fields to save multiple values
- Custom fields: In what order are they saved into the DB?
- 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
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Custom field value based on other custom field values
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- How to save a ToggleControl value in a meta field?
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Saving custom image meta fields
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How to display Meta Field Value?
- MySQL query to set wp_postmeta using term_taxonomy_id value
- How to Validate Post Meta type/extension (Video File Image File etc)
- Get all meta keys assigned to a post type