There are essentially three criteria here:
- do images belong to the site (are WP attachments)
- are images attached to this post
- are images used in this post
This has side effects, like:
- images used in post are not necessarily attachments
- post’s attachments aren’t necessarily used in that post
So the only reliable way to produce complete set of images, actually used in specific post’s content is indeed to parse the content (after shortcodes like galleries and embeds) for them.
After that you can [try] reverse engineer URLs into WP’s attachments, see Turn a URL into an Attachment / Post ID for example.
Related Posts:
- why does the add_action(‘the_content’) overwrite my page
- add_filter the_content in functions.php not working
- Output content to the_content before a plugin does
- Proper way to replace the_content only for pages created by custom plugin
- Filters on the_content with plugins, pages and shortcode
- Add hook after content without formatting
- Can I add content before post content without using the_content filter
- WordPress Add advertising ads befor and after content with periority [closed]
- Which action/filter can i use for a Member Plugin [closed]
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- Change Page’s Tag Using functions.php File
- How to disable Gutenberg editor?
- Edit plugin without hooks in functions.php
- WordPress apply_filters() Arguments Missing
- WordPress adding tags into plugin content
- Removing user contact methods works from functions.php but not from a plugin
- Modify the_content after the more tag
- Pass A Value From Outside To A Plugin Variable
- Is there any multiple filter/criteria plugin for wordpress? [closed]
- How to prepend to the_title for admin-side plugin’s use
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- plugin_action_links_{$plugin_file} hook not in the main plugin file
- Creating search filter through plugin
- Add Fields with Sub-Fields to WP Job Manager
- merging an array to an existing array using add_filter
- What is the purpose of $merged_filters?
- Changing image URLs in media library
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- WordPress Social Login > Post to a users Facebook wall
- Is there a filter for get_post_custom()?
- Plugin Using get_the_content Causing Issues With Tag
- Can I hook into get_avatar to supply a hash instead of an email?
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- How to append to title via functions.php for auto-posting plugin [duplicate]
- How to find the origin of a file upload from within wp_handle_upload?
- How to get the element ID from new menu list that added with add_filter()?
- White page by using filter template_include
- Filtering WooCommerce Orders by Category
- How to remove plugin metaboxes from edit.php
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- External Script Using WP – Hooks / Actions Not Working?
- Is there a way to figure out which action/filter invoked a function?
- Add sub menu page in your plugin
- Check if variable is set in filter
- Passing stored variables to add_filter
- Modify page title and subtitle with a plugin
- override filter in a plugin
- This WordPress plugin isn’t creating links correctly
- how to place a link on the first post only using a plugin
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- Change text string in a plugin
- the_content() printing DOCTYPE, and tags in the middle of page
- How to use filter to disable adding a product to wishlist?
- correctness of URL
- Advanced Custom Fields (acf) – Filter Relationship by Taxonomies not Post Type
- How do I change where a plugin pulls updates from?
- How to use apply_filters?
- what is the point of telling add_filter how many parameters you want passed to the function?
- How to add filter for wordpress plugin?
- How to hook into action/filter call
- Excluding specific post from custom next/previous theme function
- Want to create custom design of progress indicator in wpforms
- Replace the_content with ACF Flexible Content via function
- Unpublished Pages Failing To Appear On Custom Path
- WooCommerce Product Table – filter query on attributes
- Does having apply_filters in the middle of an array make a difference?
- Disable WC Bookings automatic order completion [closed]
- how can I edit the HTML of yith ajax product filter
- Plugin function in child theme
- Customize plugin’s output: filters or setters: looking for an advice
- How to echo a PHP Code After the Content
- Override filter variable not working
- Remove action added in plugin class from theme
- Title and date of last post stays on page even after replacing the_content
- Show custom taxonomy in theme
- Using multi-dimensional array with filter
- Why is every single HTML tag being stripped out of liveblog entries?
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- Add Filter to get_next_posts_link
- Passing a parameter to filter and action functions
- How Can the_post Be Hooked Like the_content and the_excerpt?
- Jetpack Comments Change Placeholder Text
- shortcode which is introduced into entry the blog, and appears in side bar
- apply_filters to content but ignore shortcodes
- Use of apply_filter in plugin/widget class
- getpost content with all formatting for admin pages
- making a glossary with wordpress
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- How to add different CSS for galleries
- Simply Exclude – Category feed exclusion is excluding from category feed instead of just the main feed
- Add a filter to a different custom plugin
- How to change response of admin-ajax request?
- How to add a filter conditionally based on page related Conditional Tags
- WordPress plugin add_filter returning a link does not work. What is the correct way?
- Unable to pass arguments from plugin form to filter hook using ajax, the data is transferring via ajax but unable to pass as arguments in filter hooks
- How often should I execute add_filter and function declaration in Code Snippets?
- Selectively override Easy Digital Downloads protection via filter