Your third parameter of get_post_meta()
is set to false
. This means it will return an array. Even though you didn’t set a value for this custom field, it will still record an array element in the DB – so empty()
will return false.
Try switching to true
for your third param. That should return an empty string.
Related Posts:
- How to get custom post meta using REST API
- Is there any action filter/hook for validating a custom field before publishing the post?
- Filter WP_Query for posts having a certain meta-value
- Using get_post_meta with new_to_publish
- How to return Meta data from the REST API?
- Advanced Custom Fields – Get custom fields from parent page
- How to access custom order item meta data from a meta key in WooCommerce?
- Display post_object content using Advanced Custom Fields plugin
- Remove old custom field after import
- Arrange custom fields with drag and drop?
- Saving Custom Field in Attachment Window in WordPress 3.5
- Plugin to auto convert custom fields to tag
- Order by Custom Field date not recognized
- Using Custom Function With Advanced Custom Fields
- custom field with total count of Facebook likes, comments and shares
- How to show custom field’s value under post/page title in wp-admin
- Query on custom field count?
- How do I read the value of a custom field of the page?
- Displaying additional User Contact Information
- get_post_meta in sitewide tags plugin fails to return value for custom fields
- Making custom field’s ‘Name’ available in the dropdown list by default in a theme?
- 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]
- WooCommerce conditional required checkout fields [closed]
- Using more than one meta_key in pre_posts_query
- Way To Store Global Meta Values
- Delete all custom fields at once?
- Orderby custom field meta value ASC and then by date DESC
- Sorting posts ordered by custom field value
- Odd PHP Code To Display HTML Of Meta Box [closed]
- strtotime and custom field value
- Unique Post Meta Values
- query usermeta from custom field
- Creating author profiles with extra fields and exporting that data?
- WP 3.1 meta_query for multiple custom field values
- Better way to save image in custom field
- Filter Posts on Custom Fields and Show them on a new Page
- Removing link ” from ” on meta_value in custom feilds
- Jetpack post types Portfolio or Testimonials support for custom fields?
- Merge Multiple Custom Fields into one New Custom Field for Searching
- Is there a better way to list all database terms alphabetically?
- How to add a custom field in the advanced menu properties?
- Meta query with multiple custom fields for archives page ordering problem
- filter custom field values $min $max
- Select multiple images from custom field
- Custom Fields – How to create a list from multi-line entries of a single value
- Unique meta_key with array value vs repeated meta_key with single values
- How to display custom fields from a plugin
- Adding “meta” info to WP site PHP function?
- WordPress Media Uploader custom Javascript not working
- Custom fields issue [closed]
- Select custom posts by meta_value and sort by a different meta value
- List custom queried terms in the edit-tags.php?taxonomy page
- Values entered in a meta box aren’t saved
- Display meta box dropdown (from custom post type) in the page post type
- Front end register with custom fields
- how can I show name and value of Custom Fields together?
- Adding simple (one button) Audio player using Custom Fields?
- Display custom field from the front page on another page
- No result update a custom field using wp_schedule_event
- Display custom widget value in header.php
- Gravity Forms Update post meta from template [closed]
- Automatic linking terms
- Adding extra fields to front end signup form
- Problem uploading different files as custom fields with front end post form
- How to change order of posts in admin
- Display metabox title for custom fields with values
- wpdb function insert doesn’t work
- make a dropdown custom field with ‘cities’ list in it
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- Get Custom Field Name ( Label or Key ) Not Value
- Custom field on Quick Edit using select/dropdown – almost working right but not showing currently selected value
- Adding Custom Metadata to my Archive/Posts page
- Move the post title to another field
- Ordering by ACF custom field vaule
- add different custom fields value to post class if permalink or index
- author.php not showing content if Author has no Posts
- User Filter Options on Archive Page
- Create Shortcode shows only posts with custom_field meta
- Login_form add to top of form rather then bottom
- Advanced Custom Fields from Category – IF statement
- Search one custom field?
- Can’t save meta field value if the title not set
- Get a different meta value with ajax when different elements are clicked
- Delete custom fields on post publish?
- Why is wp_list_pages altering $post->ID of the page?
- How do you turn a custom field’s value into a permalink for that post?
- Permalink structure depending on custom field
- How to add custom_fields value in JSON API using create_post
- How to keep sharing stats after creating 301 redirects?
- Using Hooks. Thematic
- WP Post Meta Box Field Not Showing Updated Field
- Display posts where date field matches current month?
- Parse Shortcodes in Theme’s Custom Field?
- Update field name without losing the value
- How do delete a meta key?
- Save Custom Meta Value on Media Upload
- Is there a way to read JSON data inside Custom Fields without editing PHP? [closed]
- Saving multiple custom meta box fields
- Modal pop-up HTML code works on other sites or HTML viewers but not in the custom HTML block within a wordpress page?