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
- 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?
- gettext does not translate when called in ajax
- Execute one AJAX request after another AJAX request finished
- Ajax and autocomplete
- Load tinyMCE / wp_editor() via AJAX [duplicate]
- Admin Media grid view images won’t load
- How to disable WordPress Media resize different size version?
- Confused on AJAX submit form through page template
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Nonces, AJAX, script variables & security in WordPress
- How to host different file formats/types for a media attachment without creating multiple attachments?
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- Show selected images on top in Media Manager
- wp_localize_script escaping my url – fix or alternative
- Insert wp_editor on front-end with AJAX?
- Buddypress: Load Ajax Without Template Pack [closed]
- Woocommerce Ajax Add cart not working
- Replacing Images in Media Library
- I have to post data by AJAX in wordpress to another Website
- WordPress ajax problem need wordpress expert?
- wp_ajax function did not call
- Can’t get result from sql using ajax result
- Theme Customizer – Conditional Controls
- Edit a different page in WP Customizer
- WordPress AJAX – how to return true or false in the callback function
- WordPress Ajax POST Error 403 admin-ajax.php
- WordPress search results with Ajax, get_post_type() not working
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- Audio TAG Not using MediaElement When Page is loaded through ajax
- All AJAX requests return a 400 error
- Unable to successfully verify nonce
- Create custom POST Method URL
- Get images attached to a specific page
- Is it possible to determine whether a page is a page template by page_id in ajax call?
- How do I increase the upload size only when editing special pages?
- How to stop being directed to admin.php after sending request to admin-ajax.php
- 200 return code on ‘POST /wp-admin/admin-ajax.php’ while NOT logged in
- How to make Plupload zones that will survive changes in core?
- Next Ajax call doesn’t work
- Ajax page load without reload
- need a confirmation text to appear on email submission
- How to make pages that arent indexed for ajax applications
- Why does reCAPTCHA v3 return 0 ? In custom AJAX registration form
- admin-ajax.php 400 bad request
- WordPress Ajax Page Load to skip embedded iframe
- WordPress POST AJAX call, var_dump($_POST) NULL and AJAX response empty when inside ob_start
- Set cors header for ajax requests
- Simple AJAX code that refreshes every x seconds?
- Search function – problem with whole words
- Ajax is not defined
- Get posts by category via ajax
- How to manually set an attachment in a post?
- WordPress 4.9.6 – IncludeMe & getAjax GET using wrong URL
- Create secondary Archive page format?
- Media import failed in the WordPress importer
- wordpress ajax upload media not working
- Images are not getting uploaded
- Media Library doesn’t allow uploads? Upload Directory
- Weird admin-ajax.php problem
- Ajax contact form returnig 0
- using media_handle_sideload() to add mp4 files to Media Library
- Can’t update WP Editor after Ajax
- How can I create more “create attachment” custom field – any idea?
- Media uploader & manager: add/remove class on image with checkbox
- Posting to loop.php file
- How can comments be turned off for media attachments on WordPress?
- Question regarding the file path for media_sideload_image and wp_upload_dir()
- Running js in html code with same content
- How to get current_user_id from wordpress in node js?
- how can i create get request unis ajax without expecting return value
- AJAX call not initializing for non-admins in WordPress
- Simplifying ‘Add Media’ Modal in front-end Content Editor
- contact form 7 form not working in admin panel
- Help with jquery/ajax requests