Is your post to image association custom?
If not attachments should be automatically deleted by Wordpess.
If the connection is custom, WordPress provides a delete_post action that fires before and after a post is deleted, it will pass the ID of the post so you can use that to delete all custom content associated with it.
Related Posts:
- Media library – Limit images to custom post type
- Creating a metabox to upload multiple images, Ignoring The Featured Image
- How to hide CPT files from media library programmatically
- Add metabox with media uploader in a custom post type [duplicate]
- How do I add media to a custom post type?
- How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page
- How do I organize photos for multiple galleries?
- Remove fields on media uploader for custom page type – not working for “From Computer” or “From Url” tabs?
- Duplicate Custom Header Functionality into the post edit screen
- how to get URL of media uploaded to WordPress via media_handle_sideload()
- Hide editor while keeping add media button in custom post type
- File sharing platform for user contributions? [closed]
- Cannot upload featured image to a custom post type
- Custom Attachment Type
- Save data is post using php front end
- Attaching more than 1 parent (Post) to a media file
- Cant move file after media_handle_upload
- Custom post type Featured Image popup not working
- Detach WordPress Media Files In Bulk
- Correctly delete posts with meta and attachments [duplicate]
- Using meta_query, how can i filter by a custom field and order by another one?
- Is it possible to change the URL of custom post types to hide the post type slug?
- manage posts custom column is not populating data from meta boxes
- Create child page within custom post type
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- How can i link post_row_actions() with a custom action function
- Exclude custom function content from certain pages
- custom post type taxonomies UI radiobuttons not checkboxes
- How do I write this SQL statement for Posts written in last 24 hours?
- Before Delete Post
- Custom WP TItle from custom template with dynamic URL structure
- Custom Post Type | Fatal Error on register_post_type()
- taxonomy template for custom post type the same as the archive
- How to sort custom post type posts in default order by multiple fields?
- WordPress theme options vs custom post types
- if custom posts type exists and there are posts load script
- Custom Post-to-Post with multiple parents?
- How to connect two custom post types with nested loops
- custom post type not showing in menu
- Get custom taxonomies from multiple posts
- Post image in WordPress not appearing on home page
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Limit number of custom posts per taxonomy
- How to change wp prefix for custom post type only?
- How to handle paged param in post and custom-post-type?
- Allow add new post access to custom post but not wp post for some role
- Blog posts for custom post type only
- Displaying Posts from Custom Post Types
- Custom Post Types strange pagination problem
- sub CPT and CRUD
- Pagination custom post type not working with rewrite slug
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- How can I have different content for different countries?
- ACF repeater field usage
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Retrieving meta-box from a custom-post-type
- Loop through posts of only 2 statuses
- providing access to post_id or post inside functions.php
- custom query with custom post type and category slug
- Overriding Plugin Function in Child Theme
- Get custom category ID of current custom post within the loop
- Post query missing an elseif statement
- How to limit what Editors see in the admin?
- Update custom post type title
- Custom Post Type Archive Not Showing Posts
- Custom Post Type Template Insert not working properply
- Custom Post Type Pagination on Single.php?
- display custom post on separate page
- Add custom post type to query
- How does one go about converting custom post type to post format?
- How to display magic field’s custom write panel in wordpress theme?
- Admin slow on Postlist (over 30k Posts in Database)
- How can i show ACF in post excerpts
- Custom post type category link redirecting to 404 page
- Disable single page for a custom post type based on a custom field
- Query to Exclude Child Pages from Custom Post Type Archive
- Getting a Post ID to show its content in a Popup
- How to output custom post type title on custom page with category next to it?
- How to make password protected posts that will expire after they are used?
- Remove CPT Slug with 2 taxonomies and 1 post meta
- Posts show up under “published” but not “all”
- Single Page of Custom Post Type Not Showing the Content Of post
- “Trash”, “Draft” and count not showing for custom post type in admin panel
- Multiple loops for custom post type to spread data across rows
- Generate slug and meta data if meta field is empty
- Why is a custom post type’s URL “/?cposts=name-of-the-post” but default post’s URL is “/?p=ID”?
- Redirect Custom Post Type after user submits update
- WP_Query get posts where post_name is empty
- Display all post types together
- Custom Post Type Tags Showing Under Regular Post Tags
- Taxonomy and Rewrite Structure
- Pagination for a Custom Taxonomy
- Problem retrieving custom field for a custom post type
- Only One Post of Custom Post Type Appearing on Template Page
- Remove custom meta boxes from custom post type
- is therer any wordpress function to retrieve a specific html element from post content
- How to rewrite custom slugs that follow my rules
- Problem with shortcode
- Cannot create custom post types with a specific name
- Exclude multiple custom post types from search