You can use the function update_user_meta
for logged in users and the php function setcookie
for the visitors. Here is a start how to work with update_user_meta
You can run this function on submission of the form or by running it by AJAX, i would recommend you to run it with AJAX.
function wpse_update_user_commentform() {
/**
* Get values from the selected
* Dropdown as tha variable $side
* Change this to your dropdown name
*/
$side = $_POST['dropdown'];
$comment_id = get_comment_ID();
// Update the comment meta "comment_side" to the selected value
update_comment_meta( $comment_id, 'comment_side', $side );
}
Related Posts:
- Save metabox with multiple checkbox array
- Ordering posts by metadata
- Run Shortcode of post’s custom field in functions.php / Plugin
- 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
- Displaying Custom Post Meta
- How can I add an image upload field directly to a custom write panel?
- Post meta vs separate database tables
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- How to validate custom fields in custom post type?
- How to add tab which is visible only in admin side of product in woocommerce? [closed]
- Creating custom field with drop down on new post page
- Retrieving custom fields with $wpdb->get_results
- How to create Image gallery Metabox in wordpress [closed]
- Utilize TinyMCE hyperlink chooser outside of TinyMCE
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- anything like add_meta_box for categories?
- template_redirect for single posts w/ custom fields
- How can I free up the memory used by update_post_meta?
- Is there a way to list tags order by post_meta field
- Comment `Reply` link doesn’t work if comments are loaded from ajax
- Show comments fields in two columns
- Support auto-save and revisions for custom fields
- Best choice of options/settings framework for plugin/theme development
- Plugin development: get_post_meta is not working [closed]
- Act on user meta updated, but only once
- Global $post not working in OOP function WordPress
- How to check if Woocommerce Order number equals to post ID?
- Adding set of custom fields to WordPress Post in Dashboard
- update post meta for checkbox in the admin when inserted in the front-end
- 403 Error when text is pasted in Custom Metabox Textarea
- get_posts() not working when accessing with a custom user role
- Custom Taxonomy to dropdown box on adminside wordpress
- Create & Save multiple Meta-boxes
- Add a Save Button to Custom Meta Box [duplicate]
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- Strange issue saving custom field data for a WooCommerce order
- Woocommerce – Convert Delivery method into a custom field
- Add a default WP comment form to forum template
- How to get Metabox custom field to show checked if value is updated using post meta query?
- How do I update a field of a meta box?
- Input value from metabox is not found in $_POST after post save
- Doubts about the use of metadata and how this can affect performance on WordPress
- update_post_meta not working in a loop
- Get draggable widgets on Edit Post page
- Custom code for WordPress dynamic menu
- Custom fields for custom post type
- Checked() function on a multidimensional array
- What is the best way to store a few fields?
- Delist entries in the_loop
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- How can I add a simple custom field to my plugin?
- Ajax is not working in a loop
- 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
- How to save post meta as an array in Gutenberg?
- how to load the comment template from a plugin
- per blog metadata for plugin
- How to format custom fields when editing an attachment?
- Using delete_post_meta for deleting multiple selected options
- Get audio metadata on file upload
- Plugin can’t be activated [closed]
- Remove Meta-boxes (Yoast SEO plugin) [duplicate]
- Is there a way to add a link with add_post_meta?
- Adjust query on single
- how to add custom fields into new & update post page?
- Customise Grouped Product display in Woocommerce with custom column
- Why is $_POST empty when saving custom Meta Box?
- Condition to check previous next article post title
- register_meta not showing custom post type metabox data in rest api
- WP_Query not ordering correctly
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Adding customs fields on each product on the cart
- Insert, update or remove data from database (usermeta)
- add_meta_box does not display meta box in Admin
- Unexpected issue when using attachment_fields_to_edit filter
- WordPress delete mysql rows with string
- How to get post that has non zero or greater than zero meta value
- Saving post meta
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Echo out custom fields in comments
- Get Commentor IP When Marking Comment As Spam
- Include add_post_meta in a plugin
- How can i call from custom fields to the category editor?
- 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
- Can I log the searches that are returning 404 in the DB?
- A better way of getting draft posts that has a particular post meta using get_posts function
- Custom fields in the billing address section woocommerce
- Add File field in WooCommerce Box office plugin
- Yet another wp_insert_post infinite loop. What is wrong?
- Data Validation, dynamically generated fields (select for example)
- Initialize class inside plugin
- Thumbnails for media Library images
- How to Rewrite WordPress URL for a Plugin
- Add query string variables to all hyperlinks URL matching a specified domain
- WordPress multiple user roles accessing on their information on one site?
- loop and in admin header problem
- When editing a post with a custom meta box the values aren’t displaying correctly
- How do I replace title with my plugin?