Finally found an answer for this and checked it worked on my situation.
How to upload image without post ID using the new media uploader?
// Set post_id to 0 when Add Media button clicked
jQuery('#insert-media-button').on('click', function( event ){
event.preventDefault();
wp.media.model.settings.post.id = 0;
});
This will set all the images uploaded via Add media button to 0 which will show up as (Unattached)
in backend.
Related Posts:
- How to allow to user non logged in WP system upload in media library?
- Distinguish between 2 instances of admin-ajax.php
- Load minimum WordPress environment
- admin-ajax.php returns 0. How do I debug it and fix it?
- Add item to media library from blob or dataUrl
- Plupload in metabox – AJAX action not working in Class
- AJAX action not triggering PHP function
- Using wp_handle_upload and media_handle_sideload with ajax
- How to know what page is calling admin-ajax.php?
- Ajax image upload with media_handle_upload and form.js
- wp_handle_upload returns empty error array
- Pass additional parameter with async upload
- How to disable drag-and-drop upload function in Media Library?
- Get uploaded attachment width & height and attachment ID after upload them
- Why is the file not uploading to the server?
- Filter images from media library by guid meta field
- How to locate the js code and php code for certain function?
- Make inline uploader (plupload) on options page upload to a specific folder
- Frontend AJAX Media Upload returning 404
- How to require files in a custom endpoint
- Cannot add multiple single images at once
- How to send custom variable in Media Uploader ajax request?
- wp_enqueue_media problem
- Is custom behaviour possible when asynchronously uploading?
- WordPress Permissions Issue for Media Library / uploading
- Removing custom physical folders with rmdir
- PHP “php://input” vs $_POST
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- How to solve the error “SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.” in IE
- Show spinner GIF during an $http request in AngularJS?
- Refresh HTML Page in Browser Automatically on Timer – Every 15 Min
- JavaScript implementation of Gzip
- jQuery: Performing synchronous AJAX requests
- ASP.NET MVC controller actions that return JSON or partial html
- jQuery’s .on() method combined with the submit event
- How to Protect Uploads, if User is not Logged In?
- Ajax takes 10x as long as it should/could
- How to check if I am in admin-ajax.php?
- Plupload Intergration in a meta-box?
- How to Fix HTTP Error When Uploading Images?
- Trigger refresh for new media manager in 3.5
- Best way to end WordPress ajax request and why?
- How to load wp_editor() through AJAX/jQuery
- Physical organization of wordpress media library (Real Media Library plugin)
- Extend Media Library
- Upload Multiple Files With media_handle_upload
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- How to cache json with wp-super cache
- Why use wp_send_json() over echo json_encode()?
- Why use admin-ajax.php and how does it work?
- Upload images to remote server
- How to get a unique nonce for each Ajax request?
- Open a Thickbox with content trough AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- How to delete resized (cropped) image uploads and prevent future resizing?
- How to show all available images in WP’s media library when using the Polylang plugin?
- Checking if a file is already in the Media Library
- Why not register shortcodes if is_admin dashboard?
- WordPress AJAX with Axios
- Upload post thumbnail from the front end
- Why is die() used at the end of function that handles an Ajax request?
- Give users a maximum upload capacity; limit the number of files a user can upload OR limit the number of files per upload
- Why might a plugin’s ‘do_shortcode’ not work in an AJAX request?
- Does WordPress Super User or Administrators can create and edit post and media on behalf of a user
- Xhr.send : PDF upload failed with status 400 and response 0
- How to use AJAX in wordpress front end?
- How to make Contact Form 7 work when injected via AJAX in WordPress?
- How do i set up ajax nonce
- wp_remote_post to admin-ajax.php isn’t sending body value
- Separating HTML and PHP from the Script?
- Adding multiple MIME types of the same extension to WordPress?
- WordPress Media Uploader not displaying image that has just been uploaded
- I’m trying to register with AJAX
- WordPress send Ajax where click button
- wordpress filter for searching categories with ajax not working
- contact form 7 form not working in admin panel
- admin-ajax.php won’t load without logging as admin- JSON Parse error: Unexpected EOF
- add_post_meta not working within AJAX function
- Add URL in image upload error message
- I can’t see all images in my media library – How Can I reset the index of that library?
- admin-ajax.php 400 (Bad Request) what am I doing wrong?
- How does the security of admin_ajax.php work?
- Object name undefined using localize script
- Catch Form value at AJAX Form submit
- nonce_user_logged_out to assign guests unique nonces breaks ajax calls
- Nonce verification problem when logging in after a logout
- Ajax response from Media Selection does not update ALL information more than once
- Help with jquery/ajax requests
- Convert base64 string to WordPress attachment uploads multiple images instead of a single one
- Getting featured image from WP_Query
- register_rest_route to send via ajax as guest results to 403
- Clicking “Show More Comments” loads the same visible comments [closed]
- How to save WordPress post and attachment images from front end using media library?
- No full page reload when navigating from page A to page B: is this possible with WordPress?
- How can I with implement ajax based numbered pagination to posts which are displayed via ajax?
- admin-ajax issue(internal error 500) in the core and plugins functionality
- Ajax More Load More Button Not Working
- Is AJAX relevant when inserting a new post programmatically?