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
- update post meta for checkbox in the admin when inserted in the front-end
- Show special field when correct shipping is chosen
- get_posts() not working when accessing with a custom user role
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- ORDER BY wp_post custom column name in wp_query
- Woocommerce checkout update totals with datepicker
- Including the necessary functions for a custom ajax registration form
- How to create database table, add data, update and delete using wpdb via plugins?
- Saving value of a selection option in comment form as comment meta
- 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)
- AJAX search posts and pages
- How to localize admin.php only once
- get post attachment using ajax
- Strange issue saving custom field data for a WooCommerce order
- Create a new post using rest api and save featured image using an external image url
- Woocommerce – Convert Delivery method into a custom field
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- how to search users by ajax live search
- Getting List of all registered Dashboard Widgets
- Orderby CPT custom fields not working
- what is the difference between these phares?
- WP_Query filters
- How to fetch only current hour posts?
- wp.template() returns tags in Ajax response
- Storing data in wordpress database from ajax call from different website
- WordPress pre_get_posts with combined results of two queries (OR)
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Run Shortcode of post’s custom field in functions.php / Plugin
- How to use TinyMCE Editor for one of my custom post meta field?
- Create custom HTML/JS app inside page
- Search: how to extend the existing search to include a custom table
- Use just a shortcode from another page
- template_redirect or admin-ajax.php?
- Including comments meta box on a plugin page
- Custom code for WordPress dynamic menu
- how to get all the child category name in a specified category name?
- how to get context information inside my funcion
- how to invoke wordpress API from other existing PHP system
- Redirect to another page using contact form 7? [closed]
- How to add a widget to the post editing view?
- AJAX form post returns 0
- How I can use order by of the custom post title?
- Update Data parameter of a wp_localize_script() call
- Checked() function on a multidimensional array
- jquery & ajax sending data to php
- wp_localize_script is not adding a global variable for javascript
- What is the best way to store a few fields?
- Delist entries in the_loop
- Custom post type’s extra fields – how to handle?
- How to query children by post name/slug
- Adding admin menus to wordpress
- Can’t get AJAX call working in custom plugin
- Bad Request in AJAX
- How can I add a simple custom field to my plugin?
- Prevent WordPress automatically processing certain URL queries
- ajax recursive calls on wordpress returning answers outsite the function scope
- Ajax submit result opens in admin-ajax.php
- Are there any security risks when submitting data-attribute data through AJAX?
- Automating the process of shortcode generation in a plugin – how is it done?
- insert query on a custom table using ajax with jQuery plugin Jeditable
- How to get error object returned by wp_create_user
- Plugin AJAX Save to Custom Table
- Meta box on options page save form problem
- Moving/dragging a metabox removes TinyMCE’s content
- WP nonce field checkbox prints checked=’checked’ outside input field
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- WP ajax requests not stacking?
- How to save post meta as an array in Gutenberg?
- how to load the comment template from a plugin
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- per blog metadata for plugin
- How remove trashed WooCommerce orders from wc_get_orders() result?
- How to add custom post widgets as tags into wordpress
- AJAX button with success callback. (Titan Framework)