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

Update attachment metadata fails

If you want to update title and description you should not use wp_update_attachment_metadata attachment title and description is not a meta it’s a main post detail (attachment is custom post), you can do this with following code.

$attachment = array(
  'ID' => $id,
  'post_title' => $title,
  'post_content' => $description
);
// now update main post body
wp_update_post( $attachment );

Related Posts:

  1. delete attachment for one post without deleting actual attachment post
  2. Why this plugin doesn’t work with media upload page?
  3. How to check an ajax nonce in PHP
  4. Long Polling: Stuck in while loop
  5. How to update Comment post meta through an Ajax call
  6. Attach time/date stamp on add_post_meta
  7. bulk update meta value with ajax
  8. Update status, meta while inside a post using AJAX button
  9. i’m trying to get all my media query attachments via ajax in wordpress
  10. Filter images from media library by guid meta field
  11. Frontend AJAX Media Upload returning 404
  12. Want to send ajax request in wordpress to a custom file in plugin
  13. delete post meta data in array WordPress
  14. Allow guest to update custom post met using ajax
  15. Data from ajax not updating post meta
  16. add_post_meta not working within AJAX function
  17. WordPress & Ajax
  18. WordPress blocking polling request when signed into Admin
  19. Why does my Ajax Get request give a 400 bad request?
  20. what’s the way to access variables from serializeArray
  21. using ajax to query sql
  22. WooCommerce AJAX cross domain add to cart
  23. How To Pass Ajax Value to PHP Query?
  24. Facebook Pixel + WooCommerce + AJAX = Confusion
  25. A refreshless WordPress website
  26. AJAX function needed (toggle text) [closed]
  27. Dynamic dependent select box getting null value
  28. Can a scrollable date picker be done in WordPress for archives?
  29. Ajax load more posts button
  30. Send button using own contact form [closed]
  31. wordpress ajax always return 0
  32. ajax for visitors wordpress
  33. WordPress wp_localize_script nonce and ajax URL
  34. PHP cookie not set within AJAX call
  35. Call pre_get_posts inside ajax
  36. WordPress Ajax send response on every iteration of a loop
  37. get_template_part() does not render after the ajax request
  38. Translating wordpress foreach to ajax
  39. WordPress Ajax – looping data into a table
  40. $wpdb Ajax not redirecting to main page
  41. AJAX loading with custom parameters
  42. Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php
  43. Use Ajax to get an Options Settings Value
  44. how reduce fetch/XHR response time
  45. Running js in html code with same content
  46. How to get current_user_id from wordpress in node js?
  47. Image Attachments Query Not Working If Post Is Loaded Via Ajax
  48. How to get data with Select AJAX PHP
  49. Adding custom fields to Wired Impact Volunteer Management Plugin
  50. wordpress ajax bad request 400
  51. Add “load more” functionality to an AJAX response
  52. how to update pagination after ajax call page 2 show 0
  53. Custom WP rest api endpoint only working on non https?
  54. how can i create get request unis ajax without expecting return value
  55. Placing ajax actions in different class
  56. Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
  57. Access to a data from a response AJAX called in a template file php
  58. How to update my jquery/PHP function to add/remove user as favorites in (WordPress) users list
  59. AJAX call not initializing for non-admins in WordPress
  60. Can’t have two simultaneous charts using Apex Charts
  61. get_permalink() returns in wrong format via AJAX
  62. Escaping admin_url output being passed to js (esc_js vs esc_url)
  63. weird Internal Server Error – no error log produced
  64. Run PHPMailer function after ajax function completes that adds row to custom table
  65. Why are the most recent posts not appearing in a fetch request, unless I’m logged in?
  66. Successful ajax call returns lots of whitespace and text of code with 0
  67. randomly get 400 error while user is logged in wp_ajax
  68. How to use Ajax with WordPress
  69. Using $.ajax getting 500 error
  70. How to submit a button automatically after every scheduled hours?
  71. How to add a “Load more” button for the comment section in WordPress?
  72. At what stage does wp_ajax hooks gets applied during WordPress request?
  73. Blocking admin-ajax.php from outside domain
  74. AJAX request blocked by CORS policy
  75. Ajax call to a function in another module returns a 400 (Bad Request) error
  76. Uncaught ReferenceError: custom_ajax is not defined
  77. WordPress REST API FormData: Form Not Submitted When No Files Attached
  78. wp-admin/admin-ajax.php 400 Bad request (chrome console)
  79. How to stop a nonce from being cached in an inline script, or alternatives to regenerate it if expired?
  80. JQuery UI Autocomplete/Autosuggest WordPress
  81. Logout and redirect WordPress user id without he refresh the page
  82. How to show custom fields in modal in category page
  83. Cannot get user’s ACF data when using a template part in a WP_User_Query
  84. How to use AJAX in wordpress front end?
  85. How to make Contact Form 7 work when injected via AJAX in WordPress?
  86. How do i set up ajax nonce
  87. wp_remote_post to admin-ajax.php isn’t sending body value
  88. Separating HTML and PHP from the Script?
  89. I’m trying to register with AJAX
  90. WordPress send Ajax where click button
  91. How to append $metadata[‘sizes’] to metadata when using ‘wp_generate_attachment_metadata?
  92. wordpress filter for searching categories with ajax not working
  93. How can I get or the intermediate size of an image with wp_get_attachment_image_src without using post meta?
  94. contact form 7 form not working in admin panel
  95. admin-ajax.php won’t load without logging as admin- JSON Parse error: Unexpected EOF
  96. admin-ajax.php 400 (Bad Request) what am I doing wrong?
  97. How does the security of admin_ajax.php work?
  98. Object name undefined using localize script
  99. Removing custom physical folders with rmdir
  100. Catch Form value at AJAX Form submit
Categories ajax Tags ajax, attachments, post-meta
Get registered custom fields or post meta even if empty
Redirecting users based on custom user meta

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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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