Skip to content

Instantly share code, notes, and snippets.

@pirate-bot
Created February 26, 2026 08:15
Show Gist options
  • Select an option

  • Save pirate-bot/83193a661dc27bc4da6ecd93d3f26ed5 to your computer and use it in GitHub Desktop.

Select an option

Save pirate-bot/83193a661dc27bc4da6ecd93d3f26ed5 to your computer and use it in GitHub Desktop.
Delete images from content on imported posts
<?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