When using the “Trim the content” option in a source’s Advanced > Content settings, some elements of the original content might get excluded from the import if they appear after the end of the word limit you’ve set. You can add the below filter if you’d like to be able to keep the missing tags when using word trimming.
This example uses the <img> element as an example. In cases when the images are stripped from the content after it is trimmed, this will ensure they are all imported while still obeying the word limit.
add_filter('wprss_ftp_trimming_keep_tags', function($tags) {
$tags = array_merge($tags, array('img'));
$tags = array_flip($tags);
$tags = array_keys($tags);
return $tags;
});
How It Works
The “Trim the content” feature works by removing all tags, trimming what is left of the content, and then adding the tags back. This ensures that content doesn’t get trimmed in the middle of a tag, thus breaking the HTML, and that only actual text gets counted toward the word limit you’ve set. When adding the tags back into the content, however, not all tags are processed.
By default, the tags that get added back are the following: <p>, <br>, <em>, <strong>, <a>, <code> .
This is deliberate and is done to improve security. This list may be changed via the wprss_ftp_trimming_keep_tags filter as shown above.