Your function is checking to see if anything “is set” before proceeding to update, and also that it isn’t an empty string. Remove the “if” portions of your update statements, or better yet, put an “else” after to delete post meta if it is empty.
Example:
if ( isset( $_POST['games_database_game_release'] ) && $_POST['games_database_game_release'] != '' ) {
update_post_meta( $games_database_id, 'game_release', $_POST['games_database_game_release'] );
} else {
delete_post_meta( $games_database_id, 'game_release');
}
Related Posts:
- Advanced search form with filters for custom taxonomies and custom fields
- WordPress 3.3 custom post type with /%postname%/ permastruct?
- Show Custom Taxonomy Inside Custom Menu
- Custom Taxonomy’s Label to change the text appearing in Appearance > Menu
- Have different search results template depending of custom post type searched
- Why does a custom post type need the ”hierarchical’ args setting?
- How do I programmatically add items of content to a custom post type?
- Created a custom post type- can’t view it
- order by meta_value serialized array
- bulk Update post_meta with default values
- WP_Query pagination using only numbers instead of /page/1 on URL
- How do I set the content for a post of a particular CPT?
- Uploaded image not appearing in custom post type
- Output the slug and name of a CPT single post taxonomy term
- Slug for standard post post_type
- Paginate_links links not working accordingly to how I do query the page
- Parent page using wp_dropdown_pages and multiple post types
- Query for custom post type objects in a taxonomy and with a meta value
- Get post type from taxonomy or category page
- Add nonexisting pages to navigation
- How to add plugin custom field to custom post type?
- Multiple post type queries (with specific arguments for each)
- Is it possible to create a post using a metabox?
- Custom Post Type and Labels
- related posts – pulling tags from a specific post type
- WP 3.0.5 – Custom posts matching 2 taxonomies
- Custom Post Type Loop within Shortcode
- How can you handle rewrite rules for custom post types with option to filter on custom taxonomy terms?
- How do I make a custom taxonomy for a CPT appear inbetween title and editor boxes?
- How to add post_type=value when editing that post type in the WordPress admin?
- Change archive page template using pre_get_post
- Force documents to appear in Featured Image dialogue
- Custom post type redirected to homepage – how to debug
- Filtering WP_Query Dynamically on the Front-End
- How to retain $_POST data when submitting form to custom page
- custom taxonamy and post type
- retrieve Meta field value from CPT and set those values as Image Meta Field “Title”
- Taxonomy custom post type URL
- Custom post type archive page – Posts overview – with one modal for multiple posts?
- Getting categories of posts under a custom taxonomy
- How do I display the taxonomy for a custom post type in an array
- Is it possible to to use custom post type types on a page with the same slug somehow?
- WordPress custom post query with pagination
- Custom Post Fields at the beginning of a Custom Permalink
- Add term to custom post type on draft
- When an unregistered user submits a form for a custom post type, send an email that lets them delete their post
- Multiple tag cloud filtering
- add_rewrite_rule and passing variables for custom post types
- Possible to filter custom post type with multiple meta data?
- Best way to organize book-page structure
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Custom templates for a specific category
- Three Most Recent Posts, One Per Term
- Show all tags on custom post type
- How to automatic update date and time when save custom post type
- get_the_tag_list() returns bad links
- Filter second dropdown (tax) based on first dropdown (cpt)
- Excluding a Custom Post Type with a specific tag using pre_get_posts
- How to add a sub directory to WordPress single posts without affecting other post types?
- How do you make a list and list item relation if custom post types?
- Two custom post types divided in two columns inside a bootstrap carousel
- Getting array_merge(): Argument #2 is not an array on register_post_type
- Is it possible to sort metabox teaxtarea values?
- How can I relate custom post types?
- creating files for displaying different custom post type posts with paging
- Display author box on just certain category posts?
- Custom post type posts wont show in wp_nav_menu()
- “Order” doesn’t work in custom loop?
- Permalink with hierarchy of Custom Post Types
- How do I set a post slug automatically based on taxonomy?
- Get a list of custom post type (property) when clicked on custom taxonomy 1 (rent or sale) from custom taxonomy 2 (city) page
- How to divide Subcategories into pages of parent category wordpress
- Is there any filter to add a custom attribute to the tag in admin panel?
- Display Posts that fit a certain criteria on Category pages
- Custom post type category returns null
- Custom post type order by post_title
- Tell wordpress to show a single page instead of an archive page
- Modify Url for Edit Post Screen in Custom Post Type
- How to get post by meta value
- Post display in separate page [duplicate]
- Create dynamic logo carousel without using any plugin
- Delete Post by User
- WordPress Contents Migration
- Custom post type translation
- Test for post type in request filter?
- What kind of post type structure do I need to manage a list of ranked skills?
- Have two (permalinks) urls for a same custom post type
- If taxonomy show class of active
- Query Posts From Multiple Post Types
- Custom Post Type Permalinks Problem
- Custom Post Types (Changing post style based on category)
- How to loop through custom posts in admin edit screen
- Notices when submitting custom post type from front-end
- querying to custom field over ACF REST API
- Fatal Error WordPress Custom Post Type UI + WPML
- Paginate yearly archives for a custom post type
- Custom taxonomy meta fields
- Why does wp_generate_uuid4() timeout?
- Delete Term from Custom Taxonomy using wp_delete_term isn’t working