Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

saving/reading custom field value does not work – no value gets POSTed

You have two issues:

1.- Your are not passing the correct post ID. To solve this problem change:

update_post_meta( $post->ID, 'my_key', $mydata );

To:

update_post_meta( $post_id, 'my_key', $mydata );

2.- Your are not createing the input correctly, the name attribute is missed:

Change:

echo '<input type="text" value="' . $value . '" id="my_id">';

To:

echo '<input type="text" value="' . $value . '" id="my_id" name="my_id">';

Related Posts:

  1. Update all posts automatically when using post_meta
  2. Better post meta efficiency?
  3. Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
  4. Human Time Diff, change mins to minutes
  5. Change post format using custom field
  6. Sanitizing `wp_editor();` Values for Database, Edit, and Display
  7. What Is meta_id In wp_postmeta?
  8. Add custom field automatically (add_post_meta) with value based on number of words of article
  9. Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
  10. How can I sort posts by the date and a custom meta field?
  11. Force the “Choose from the most used tags” meta box section to always be expanded
  12. Cannot retrieve a custom RSS field from posts
  13. Customize rel=canonical tag for single blog post
  14. Change all author links in Blog roll
  15. How to I retrieve the ID from the Posts page?
  16. Get post meta retrieving wrong value
  17. if in category but only with post meta
  18. Saving Post Data in Another Database
  19. Add multiple meta keys to a post at once
  20. Post meta not working
  21. How do you update post date (year only) in a separate custom field?
  22. WP_Query sort by meta_value_num or date
  23. Check if user has avatar
  24. Creating Ordered Query using Meta_key
  25. Run function after post is updated
  26. How can I create a menu items from meta box based on users input
  27. Display a custom field rating system in the front end
  28. How enter custom post meta or custom field on box post list archive page?
  29. Two Custom Post Types Many to Many Relationship
  30. get_post_meta not working on publishing
  31. How to display the link (title) and thumbnail post?
  32. Show the content that is after the excerpt using child theme
  33. What WordPress function to use to get meta value by using meta keys?
  34. Automatically add custom fields value to wordpress post
  35. How to allow users to post only in certain category and hide elements from edit page?
  36. Meta value does not save for scheduled posts
  37. Custom Posts Query and meta_query Sort Order
  38. Is there a way to notify specific users when new posts are published to specific pages?
  39. How to do set post permalinks using 6 digit random unique function?
  40. Can’t get buddypress notifications in front-end; why do I get this error?
  41. How do I display some posts fully on the homepage, and some as an excerpt only?
  42. Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
  43. MySql query to get posts with all meta and terms
  44. Default Custom Field Value Automatically Update
  45. How to compare two posts including their meta fields on a scalable base?
  46. Categories list into registration form
  47. Getting value from get_post_custom
  48. Send post id through ajax and get the post content back
  49. Add a custom meta box in the post options that loads some html code in the header
  50. Calling Different Custom Post Timestamps in a table
  51. Is it possible to paste a link without tags and make it directly a link in a post?
  52. Display post x of y within category
  53. Force authors to Preview a post before publishing
  54. WordPress Automatic Filename Changer
  55. Query Posts With Over 1000 Views
  56. Saving custom fields to a custom taxonomy
  57. Hooking into the post editing screen for an existing page only
  58. Query Posts by Custom Field
  59. Redirect to another page using contact form 7? [closed]
  60. Order posts alphabetically: how to set order=asc in mysql query?
  61. How to automate featured posts number? [duplicate]
  62. Which PHP page is the Default Posts Page
  63. How to rate a post from Admin Side / Manually?
  64. How to save meta checkbox WordPress
  65. Prevent custom field from being updated after first publish
  66. disable Tab post on nav-menus page (Admin)
  67. Adding bootstrap classes to video shortcodes
  68. How to calculate the average of a post meta value(Numeric) of a specific author
  69. Every second post different class in blog view
  70. Format latest/newest post differently
  71. Get post ID from a link
  72. is_page Funtion for Posts ?
  73. Is there any way to tell when wp_postmeta has been updated?
  74. Create a list of posts with topic headdings
  75. Post type no single page
  76. Add field to user meta table in database when link is clicked
  77. Hide custom metabox value from custom fields
  78. Adding a user’s ID behind the tag ref link address
  79. wpColorPicker – problem with implementation to post meta
  80. The_excerpt() doesn’t parse – how to change that?
  81. Hide custom fields when empty
  82. How to only publish posts with image in it
  83. Isn’t the way posts are displayed very unefficient?
  84. Edit multiple custom post types while saving a new or edited post
  85. Add custom text automatically on each post
  86. How to check in functions.php if there is data in a WP_Query?
  87. Change post author without using wp_update_post()
  88. restrict incrementation of post vies count when refreshing the page
  89. Defined function isn’t showed on page
  90. wp_query with ajax
  91. Update post meta within save_post action
  92. WordPress 302 Redirect to Random Product/Post/Page
  93. Display post number by category
  94. Output Post with ACF Fields into other Post
  95. Updating post meta for checkbox
  96. Getting Whitescreen when publishing a post [closed]
  97. Using system date format
  98. Get post by tag
  99. Add code to a specific post’s content
  100. Related Posts function not working
Categories posts Tags custom-field, functions, post-meta, posts
WordPress always display the first menu
Is “get_template_part” hierarchy possible?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress