Created
February 26, 2026 08:15
-
-
Save pirate-bot/83193a661dc27bc4da6ecd93d3f26ed5 to your computer and use it in GitHub Desktop.
Delete images from content on imported posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Feedzy - Delete images from content at import | |
| Version: 0.0.1 | |
| Author URI: https://themeisle.com | |
| */ | |
| function bweb_feedzy_remove_img_matches( $matches ) { | |
| // Return an empty string to completely remove the image tags | |
| return ''; | |
| } | |
| add_filter('feedzy_insert_post_args', 'feedzy_remove_images_from_content', 10, 4); | |
| function feedzy_remove_images_from_content( $args, $item, $post_title, $post_content ) { | |
| // Regex pattern to match <img> tags | |
| $pattern = '/<img[^>]*>/i'; | |
| // Remove image tags using preg_replace_callback | |
| $args['post_content'] = preg_replace_callback( $pattern, 'bweb_feedzy_remove_img_matches', $post_content ); | |
| return $args; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment