So your checkbox code works fine. But the problem is.. the meta key.
If you do var_dump( $meta['vmo_code_radio_value'] );
, you’d get a NULL
because the meta key contains a newline and it will be saved as is:
update_post_meta( $post->ID, 'vmo_code_radio_value
', 'enable' );
But if you do:
var_dump( $meta['vmo_code_radio_value
'] ); // note the newline
Then you’d see the proper value: enable
.
So the fix is simple: remove the newline. I.e.
update_post_meta( $post->ID, 'vmo_code_radio_value', 'enable' );
And by the way, to retrieve a single value of a metadata, you could use get_post_meta(
like so in your case:
<post ID>, 'key', true )
$vmo_code_radio_value = get_post_meta( $post->ID, 'vmo_code_radio_value', true );
Related Posts:
- How to add tab which is visible only in admin side of product in woocommerce? [closed]
- Save metabox with multiple checkbox array
- How to create Image gallery Metabox in wordpress [closed]
- Cannot search post by taxonomy
- Best choice of options/settings framework for plugin/theme development
- Slow WP_query due to nested wp_query. Need Suggestions
- Custom Taxonomy to dropdown box on adminside wordpress
- Create & Save multiple Meta-boxes
- Dashboard – get status and position of metaboxes and pass them to ajax method
- How do I update a field of a meta box?
- Input value from metabox is not found in $_POST after post save
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- 400 Bad Request, in wordpress theme development, wp_ajax
- Ajax is not working in a loop
- Store custom meta box data as serialized array
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- Adjust query on single
- WP_Query not ordering correctly
- add_meta_box does not display meta box in Admin
- Can’t get query string in ajax call
- Return custom product in ajax call loop
- How to validate custom fields in custom post type?
- Get List of Registered Meta Boxes and Removing Them
- How can I run AJAX on a button click event?
- Empty POST data on server on AJAX request using Angular $http
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- wp_localize_script $handle
- WP Query group/order by category name
- How to post form in ajax mode and handle it in wordpress
- Using Ajax call in jQuery doesn’t work in widget
- Metabox Not Showing on Custom Post Type But On Pages and Post
- Ajax in WordPress – path issue
- WP AJAX is not working, always returns 0
- How to print raw query from WP_Query class just like in CodeIgniter
- Admin auto-refresh is interfering with Firebug — how to prevent it?
- WP_Query returns no results
- Show add_meta_box by selecting a specific category
- manage_posts_custom_column, showing serial number using increment in loop
- Woocommerce checkout update totals with datepicker
- Including the necessary functions for a custom ajax registration form
- Add a Save Button to Custom Meta Box [duplicate]
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Strange issue saving custom field data for a WooCommerce order
- Woocommerce – Convert Delivery method into a custom field
- Storing data in wordpress database from ajax call from different website
- Create custom HTML/JS app inside page
- Search: how to extend the existing search to include a custom table
- Custom code for WordPress dynamic menu
- wp_localize_script is not adding a global variable for javascript
- Delist entries in the_loop
- Can’t get AJAX call working in custom plugin
- How can I add a simple custom field to my plugin?
- How to get error object returned by wp_create_user
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- ajax working when function is on child theme but not in plugin page
- How to format custom fields when editing an attachment?
- About a programming language starts with [closed]
- Workflow for new importer plugin – your advices?
- Pagination not working with custom wp_query
- Get Posts by IDs (optionally)
- Metabox is not displaying
- Wp Meta Query does not work while simple Query Works
- want to show CMB2 metabox on woocommerce product data tab
- Customise Grouped Product display in Woocommerce with custom column
- Why is $_POST empty when saving custom Meta Box?
- Is it possible to use the MySQL’s ORDER BY FIELD() clause as part of the pre_get_posts hook?
- How to do admin ajax request in a plugin for rest api
- Ajax action has 200 status but response of No response data available for this request
- WordPress Does not grab the string sends useing AJAX response, wp_ajax hook
- Bad request 400 using class based files
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- Adding customs fields on each product on the cart
- Metabox types list
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Rate limiting ajax requests in WordPress
- ajax-action.php can’t find added action
- User meta query using Wildcard
- AJAX call of function containing javascript which is not loaded (Plugin development)
- WP Query date_query with several date range
- How to include files in the loop via ajax
- How to handle ajax Request in a complex-structured plugin?
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- Query by meta value (add a dropdown of all values)
- PHP includes with AJAX actions
- WordPress function is not called and ajax return 0
- Post Pagination does not working on WP-Query
- How can I query 3 posts from diferente categories (one of each category)
- Error in WP Query. If variable is empty it is displaying previous post value
- How to show metabox just in post.php in admin?
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- WordPress plugin: admin-ajax.php not passing data to custom function
- Show Metabox Images in slideshow instead of static
- Page reload occurs before request finishes
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- I want to display the content of a text field only if it has been entered
- Create Unique and Customized User ID for Website Members in WordPress
- Saving metabox updates causing fatal error
- How to consume external API from WordPress post editor and display the response data in the custom field?