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
- Row actions for custom post types?
- How to set parent-child relationship between differents custom post types
- Add Custom Fields to Custom Post Type RSS
- Do I need a nonce field for every meta box I add to my custom post type admin?
- Restrict custom post type to only site administrator role
- get attachments for all posts of particular post type
- Check if a custom taxonomy archive page is being displayed
- How to limit the number of terms (terms acts like categories)
- Removing custom post type from link search results
- How to add a post from a custom post type as the static page?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- How do I Make a custom post type get a custom post template in a plugin
- Check if current user has post in post type and is author role
- Separating Search Results By Post Type
- Including a custom post type in the Archives widget
- Set default option in dropdown of WP_Query?
- How can I add single catogory for custom post type?
- Custom Post Types: Custom columns with Title submenu?
- Automatically Insert Custom Field on Custom Post Type Publish
- Is it possible to associate different kinds of custom post types one to the other?
- List posts AND custom post type by category
- add_image_size for post type
- Archive page for custom post type not working
- Save an array from drop-down in custom meta box
- Custom meta box not saving
- How to display selected taxonomies by their parent
- How to create shortcode to display custom field value on a custom post type
- Get archive post type name
- How to restrict users and admin from creating new taxonomy terms?
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- Order query using custom meta data
- WP CPT Custom Sortable Column in Admin Dashboard Sort Order Random
- Get taxonomy values based on wp_query results
- Categories of Custom Post throws gives 404
- Woocommerce search pagination not working
- Completely remove custom post type permalinks (“One Page” website)
- Post ID randomly printing on page
- WordPress custom post type split into pages
- Correct procedure for advanced permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- How do i search authors from search form using author’s name
- Custom Post Types hierarchy and rewrite
- How do I know the ‘meta_key’ for ordering my custom post type
- Facebook social publisher and custom post type fields [closed]
- Querying custom post type twice on same page
- How to hyperlink content from archive page with custom post-type
- Custom post type showing same Post on all Pages
- get comments by current user inside page template
- get parent content inside child posts
- How to get specific post meta by title or id
- display custom taxonomies limited to custom post type?
- Populate a custom field dropdown with post titles by author
- Use core block functionality in a custom block gutenberg
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- Hide text if query has no posts
- Multiple custom post types showing up in edit.php
- How do I get the index for a custom post?
- “Cannot redeclare cpt_reg_tax()” because of functions.php
- Writing a custom Glossary plugin
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?
- Custom Post Type Category Displaying ALL Sub Categories as well
- register_rest_field update_callback don’t work for $_FILES
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Can I organise my custom post types by page?
- Display posts of a hierarchical custom post type excluding parent posts
- Best Plugins for Complex Index of Resources [closed]
- How Can a CPT in WordPress have a page 2 without an error?
- Get the custom post type slug but remove the rewrite prefix?
- Site loads very slow for archive custom post type page
- WordPress loop for multiple custom post types
- how to add pagination and post query in taxonomy-taxonomy-term.php? [duplicate]
- Pagination not working with custom loop
- How to bring custom meta boxes to custom post types?
- Switched server & domain name, now custom post types won’t save
- Display one post based on ID from $_GET
- Don’t display post if post has empty body
- Posts picking up old Permalinks, how to reset?
- How to query posts by category with the_title();
- Sortable admin columns ordering from custom fields isn’t combine com search and Dropdown filter
- Calling custom taxonomies
- How do I add the “orange counter” next to a Custom Post Type?