Advanced Image Handling

This section is about image importing and handling for the Feed to Post add-on.

To copy this filter, click the “Copy” button on the right of the grey bar on top, and follow the instructions.

There are two ways to achieve this.

  • Using the extraction rule:  “img”, “Remove Element”
  • Using the filter:   add_filter( 'wprss_ftp_strip_images_from_post', '__return_true' );

There are two ways to achieve this.

  • Using the extraction rule:  “img”, “Keep only the matched element(s)”
  • Using the filter:   add_filter( 'wprss_ftp_images_only_in_post_content', '__return_true' );

If your theme looks for the featured image in a custom field, rather than using the WordPress standard featured image, you can use any of the two filters below.

The first will save the URL of the image, while the second will save the ID of the image attachment. You will need to check which of the two your theme needs. If you are unsure, you can use both.

Save the URL in a meta field:

Save the ID in a meta field:

If you don’t want to use the feed source’s fallback image for feed items that do not have their own image, you can use the following filter:

You may also uncheck the option titled “Fallback to feed image” within Feed to Post’s general Images settings, as shown here.

You can also enable the use of the feed source’s fallback image for specific feed sources. This is done by using the filter to return an array of the IDs of the feed sources that should use feed source’s fallback image, as shown below. Simply change the IDs to the IDs of your feed sources.

Whenever a post is deleted, WordPress will automatically check if there are any images that were attached to the deleted post. If after deleting the posts, there are images that are now attached to nothing, they will be deleted too.

In some rare cases, typically due to conflicts with other plugins/themes, the images are not deleted and are left unattached in your gallery.

You can force Feed to Post to delete the attachments manually when deleting posts by using the filter below:

This error appears in the plugin’s Error Log when an image was not imported due to WordPress’ security check for the image’s extension. Some sites will deliver images without extensions in the URL, but will still send the correct MIME type.

The filter below will allow the plugin to bypass this security check, and import images correctly:


How do I add any of these to my site?

There are two methods to add the above code snippet to your site.

Please follow the instructions on our How to Add Actions and Filters page.