$att_ids = explode(‘,’, $_POST[‘jfiler-items-exclude-imgid’])), will return a key=>value array, so you must write your foreach loop to handle keys and values
foreach($att_ids as $key=>$att_id){
wp_delete_attachment($att_id);
}
Related Posts:
- Uploading media with the REST API
- Decrease file size upload in Media
- Adding a custom image upload size and making it selected by default?
- Failed media upload: “The uploaded file was only partially uploaded.”
- How to upload imagick resource to media in wordpress
- Upload images and attachments from frontend form
- WordPress media upload “HTTP error”
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- How do I get around “Sorry, this file type is not permitted for security reasons”?
- WordPress automatically adds links to uploaded images
- Get featured image with custom size outside WordPress
- Custom upload folder
- Convert all uploaded PNG files to PNG-8 format
- How to decrease the max file upload size without using php.ini or htaccess?
- Hook on file upload
- Can’t upload files
- Edit Image/Image Details – Replace button missing
- How to automatically convert images to WebP on WordPress?
- How to make a image-size selected by default in Media upload – WP v3.5
- Remove “Insert from URL” link in Media upload – WP 3.5
- Set media upload attachment link to none and hide it in WP v3.5
- Change the filename format of saved featured images
- Hide old attachments from wp media library
- Image Upload “exceeds the maximum upload size for this site”, but php.ini is correct
- Create Image Uploader for Widget
- Using file_exists to check file in Uploads
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- Rename image uploads with width in filename
- Modify image while uploading
- How to resize image on client-side before upload?
- Add custom image sizes to media uploader
- Specified file failed upload test. wp_upload_handle
- Is it unsafe to put php in the /wp-content/uploads directory?
- Image upload via FTP to wordpress media library
- Adding featured image via PHP
- How to enlarge the media file upload size in wordpress admin
- Restrict WordPress File Type Uploads by User Type
- Adding a querystring to an image URL when clicking ‘insert into post’?
- Use WordPress’s Media Uploader/ Manager in non WordPress php application
- wp_handle_upload – The uploaded file could not be moved to wp-content/uploads/2012/09
- Memory errors with media upload, WordPress can’t use more than 96M (while there’s 512 available!)
- Validate Uploaded Image using WordPress’ Built-in Functions?
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- How to get media objects
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Why is $_REQUEST an empty array in admin-ajax.php?
- PDF file randomly breaks upon upload
- Image upload via FormData API and AJAX is not working ($_FILES always empty)
- How to upload a file to a folder named after the user_id via plugin
- Need help with Google drive API [closed]
- Image rotation and editing stopped working in WordPress after upgrading Ubuntu from 16.04 to 18.04
- Can’t upload image using media_sideload_image
- Upload multiple images to a Woocomerce product
- Enable custom logo upload if logo is not in header
- NGINX rewrite rules for multisite
- Attach previously uploaded image to post – current code has unexpected results
- Can I get an email notification when media is uploaded to the media library?
- Blob file download problem
- zip unzip attachments in wordpress
- WordPress get_media_embedded
- WordPress upload file size error even after raising php limits
- Get uploaded image and attach it to the new post
- Why is my max_upload_filesize being limited to 2M? [duplicate]
- Images Uploaded saving onto older/previous year folders
- Convert canvas to image and upload image to server
- How to get the filename from file system and create a download link?
- WordPress İmages Upload & Delete Error
- Allow user to Upload image and manipulate it on the frontend
- custom plugin with upload files does not work
- Front end file upload returning wrong attachment url
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- I can’t set image ad fatured programatically
- How can I update WordPress plugins or WordPress itself in all server?
- async upload not working when not logged
- WordPress loading all local images from specific directory?
- Trying to generate a CSS file in wordpress uploads folder
- Maximum file Upload
- Sudden Upload HTTP errors, PHP uploads and memory limits are already to high to my taste. Anything else?
- Right path for renaming a file in uploads folder
- Attaching an upload to a user
- I want url from a file in media using title file
- WordPress file upload
- Upload images from one server to an other in wordpress
- media_handle_upload fails with gravity form submitted image
- Can’t get data from audio media
- Get posts associated with media attachment
- File path for attachments outside of wp-content/uploads
- Is custom behaviour possible when asynchronously uploading?
- How to resize an image server-side before upload?
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- show/hide attachments
- File Upload with Server in safe_mode
- Correct Syntax for uploading files to custom directory in WordPress
- An automatic way to crop images of different sizes
- Generate and upload screenshot as featured image for user-submitted post
- Pull latest Youtube Video from json url and make new post
- WordPress directories not writable after PHP version upgrade
- Changing upload directory temporarily
- Restricting Image Upload Sizes using ‘wp_handle_upload_prefilter’ – Stuck media progress bar when Featured Image?
- Unable to upload media to WordPress