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

Any way to update_post_meta with html content? It gets stripped and becomes empty

I believe the problem is with your use of sanitize_text_field (line 668 in your pastebin), which will strip markup. Proof of concept:

$str="<p>Howdy Ho!</p>";
echo $str;
echo sanitize_text_field($str);

You will need to use some other function to clean the data… possibly wp_kses

Related Posts:

  1. Save metabox with multiple checkbox array
  2. How to add tab which is visible only in admin side of product in woocommerce? [closed]
  3. How to create Image gallery Metabox in wordpress [closed]
  4. Best choice of options/settings framework for plugin/theme development
  5. Ordering posts by metadata
  6. update post meta for checkbox in the admin when inserted in the front-end
  7. Custom Taxonomy to dropdown box on adminside wordpress
  8. Create & Save multiple Meta-boxes
  9. Saving value of a selection option in comment form as comment meta
  10. Add a Save Button to Custom Meta Box [duplicate]
  11. How to get Metabox custom field to show checked if value is updated using post meta query?
  12. How do I update a field of a meta box?
  13. Input value from metabox is not found in $_POST after post save
  14. Run Shortcode of post’s custom field in functions.php / Plugin
  15. WP nonce field checkbox prints checked=’checked’ outside input field
  16. Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
  17. Adjust query on single
  18. Why is $_POST empty when saving custom Meta Box?
  19. add_meta_box does not display meta box in Admin
  20. Displaying Custom Post Meta
  21. How can you include custom post meta in search without calling each key?
  22. Custom fields for custom post type
  23. Display Custom Meta Box Field Only If Value is Present
  24. How to add a widget to the post editing view?
  25. Checked() function on a multidimensional array
  26. shortcode in a custom metabox
  27. What is the best way to store a few fields?
  28. Delist entries in the_loop
  29. Adding admin menus to wordpress
  30. Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
  31. How can I add a simple custom field to my plugin?
  32. Ajax is not working in a loop
  33. How to I retrieve the ID from the Posts page?
  34. create custom meta box with default value
  35. Problem with saving large amount of data in postmeta/usermeta
  36. Automating the process of shortcode generation in a plugin – how is it done?
  37. Move Title and the Content WYSIWYG editor position
  38. How to validate select field in post meta?
  39. How to use media upload on metabox post page without breaking TinyMCE?
  40. Meta box on options page save form problem
  41. Let’s Create Custom Field Template Documentation
  42. Moving/dragging a metabox removes TinyMCE’s content
  43. Store custom meta box data as serialized array
  44. Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
  45. How to save post meta as an array in Gutenberg?
  46. Adding custom meta boxes to specified custom post type
  47. per blog metadata for plugin
  48. How add multiple wp_editor_box to new post
  49. How to store multiple custom meta box
  50. How to add custom post widgets as tags into wordpress
  51. How to format custom fields when editing an attachment?
  52. Using delete_post_meta for deleting multiple selected options
  53. Can I save post meta programatically without setting metaboxes?
  54. How can I output WPAlchemy repeating fields meta values in my page template?
  55. Get audio metadata on file upload
  56. Plugin can’t be activated [closed]
  57. Meta box values are displayed on Custom Fields list. Is it possible to hide them?
  58. If metabox has content display content
  59. put saved metabox values back into fields and then display on the front end
  60. Add a class to post_class if more than one post shares same meta_value_num
  61. Add a meta field to the list of results for a custom post type
  62. Remove Meta-boxes (Yoast SEO plugin) [duplicate]
  63. Empty meta-box returns publishdate if no value is set?
  64. Is there a way to add a link with add_post_meta?
  65. Can I attach a plugin via my add_filter callback contents?
  66. Custom Meta Data is not being saved
  67. how to add custom fields into new & update post page?
  68. Metabox is not displaying
  69. Catch metabox values in Plugin
  70. want to show CMB2 metabox on woocommerce product data tab
  71. Customise Grouped Product display in Woocommerce with custom column
  72. Custom Post Type meta data getting deleted on bulk editing taxonomies
  73. WP_List_Table Inside Metabox With Bulk Actions Not Working on Submit
  74. Condition to check previous next article post title
  75. How to improve my non-unique metadata MySQL entries?
  76. register_meta not showing custom post type metabox data in rest api
  77. Set class if a meta value is set within post archive
  78. WP_Query not ordering correctly
  79. Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
  80. Adding customs fields on each product on the cart
  81. Insert, update or remove data from database (usermeta)
  82. Save meta box data from selected dropdown list in bbpress reply form
  83. Metabox types list
  84. WordPress Blocks, setAttributes not saving
  85. WordPress Filesystem create CSS-File – get Shortcode ID for Name
  86. Allow HTML in Custom Metabox area
  87. How to save multiple values in custom post type from front end to back end
  88. Add WordPress Meta Box saved form input to WordPress RSS feed [duplicate]
  89. Custom field metabox not showing in back-end
  90. Creating a “Related Meta” type field?
  91. set a custom post type to a taxonomy term programmatically in metabox
  92. Unexpected issue when using attachment_fields_to_edit filter
  93. Save, update, get and sanitize post meta as HTML not plain
  94. WordPress delete mysql rows with string
  95. How to get post that has non zero or greater than zero meta value
  96. Dynamically getting tags in post edit screen
  97. Saving post meta
  98. How and when would I implement some code which would take data from one part of the Db and put it in another?
  99. Create Meta boxes dynamically
  100. How to show metabox just in post.php in admin?
Categories plugin-development Tags custom-field, metabox, plugin-development, post-meta
Is there a way to call on just the content of a Page without actually using that Page? [closed]
Filter didn’t work on content class (hybrid_post_attributes)

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