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. jQuery’s .on() method combined with the submit event
  17. Why use admin-ajax.php and how does it work?
  18. Why is die() used at the end of function that handles an Ajax request?
  19. Making my AJAX powered WordPress Crawlable
  20. WordPress Ajax Data Security
  21. admin-ajax.php doesn’t work when using POST data and Axios
  22. Custom Form with Ajax
  23. How is it possible that the function of the test page works, but it does not go live?
  24. jQuery Autocomplete not working with wp_localize_script
  25. ajax delete value from custom field array
  26. WP REST API route request explain
  27. Adding meta data to an attachment post
  28. How to get custom field image url of specific size
  29. Ajax returning correct data BUT at wrong place
  30. admin-ajax.php mixed content
  31. WP-API and Basic Auth returning 403 on POST but not GET
  32. Call javascript function when category was added via ajax
  33. json encode not work in wordpress
  34. Ajax in plugin settings page returns 400 Bad Request
  35. Admin-Ajax Error
  36. WordPress Ajaxify Problem with Scroll-to [closed]
  37. Stop ajax listener from sending empty parameter to function
  38. infinite-scroll for 2 fixed height containers
  39. How to update the title of audio file through its attachment metadata
  40. is_single() conditional check inside ajax php function
  41. How to make registration form ajax?
  42. Specify ABSPATH in jQuery url
  43. WordPress action – Pass arguments into action in an AJAX call?
  44. 403 error When i send ajax request on WordPress website
  45. Ajax Call 400 Bad Request error with POST request but not with GET request
  46. While Ajax is working well, media upload isn’t showing the imagines
  47. How can I call an api before user login
  48. Problems with wordpress nonces in Ajax call
  49. Full Front End, AJAX comment system and comment reply script
  50. why does not work ajax that add_action registered in wordpress
  51. How to get post from pure frontend AJAX (using only post ID)?
  52. Auto load subcategories content with ajax
  53. Multiple AJAX requests using the same ajax_object.ajaxurl
  54. Is there a better way to access transients using javascript
  55. Filter custom post types by custom field using AJAX
  56. Refresh loop of custom posts (div) after new post is published
  57. Use ajax request to load sidebar
  58. How to detect if the ajax_query_attachments_args was triggered to set the featured image?
  59. WordPress ajax response save into database
  60. How to change request URL?
  61. Why the wp_localize_script() does not work correct in my case? ( /wp-admin/admin-ajax.php 400 (Bad Request) )
  62. Zip Files from custom fields
  63. Prevent AJAX caching from plugin
  64. Should wordpress nonce be placed in html form or in javascript file
  65. how to make sure js is enabled before executing php function
  66. ERROR while passing data from JS to PHP via AJAX
  67. ajax load more instead of pagination
  68. jQuery AJAX url wit variable
  69. Unable to delete attached file from folder programmatically
  70. How to pass array from jQuery to PHP with AJAX in WordPress?
  71. Using existing ajax data that is loaded into page
  72. Ajax call works for logged in users and returns “Bad Request” for guests [duplicate]
  73. Attachment metadata has value of ‘1’
  74. On form submitting, admin-ajax.php shows status as pending
  75. How to force the admin-ajax.php file to load over HTTPS?
  76. Unable to ajax request with meta_query
  77. get_body_class() in ajax envrionment
  78. Ajax WordPress pass post URLs
  79. How To Pass Theme Path In Javascript Ajax to Pass Id On another Page in WordPress Custom Page Template?
  80. Infinite Scroll
  81. Session variables lost during Ajax calls – WordPress – Sage Starter Theme
  82. While doing ajax, WordPress returning internal server error 500 and stating that my theme functions are undefined
  83. SHORTINIT and sessions
  84. How to use AJAX to check if user is still logged-in?
  85. Closing ajax function file with die() causes error and empty page
  86. How to load wordpress sidebar using AJAX [duplicate]
  87. using Ajax: call to undefined function get_option
  88. WordPress Pagination with ajax – Dots
  89. Bad Request when adding new post via ajax form
  90. How To Pass Ajax Value to PHP Query?
  91. Ajax load more posts button
  92. ajax for visitors wordpress
  93. PHP cookie not set within AJAX call
  94. WordPress Ajax send response on every iteration of a loop
  95. Image Attachments Query Not Working If Post Is Loaded Via Ajax
  96. Access to a data from a response AJAX called in a template file php
  97. Escaping admin_url output being passed to js (esc_js vs esc_url)
  98. wp-admin/admin-ajax.php 400 Bad request (chrome console)
  99. WordPress send Ajax where click button
  100. contact form 7 form not working in admin panel
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
  • 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