It is never nice to the users when features are deprecated but when a feature causes too many headaches, introduces UI clutter and it is used by only very small subset of the users it is just something you can not have in a free product that is being used by many people.
Some background
WordPress core has two ways to provide n excerpt for a post when only an excerpt is needed to be displayed instead of the full content.
- The excerpt text area in the post editing page can be used to provide a “manual” excerpt
- An automatic excerpt can be generated from the content
The two options are not being treated in exactly the same way and while the manual text will be used mostly “as is”, no matter what content it contains, the automatic option will remove any HTML and limit the length of the generated excerpt.
While it seems like manual excerpt is the way to go whenever you need an excerpt, it requires more time to do, probably just mostly repeating the first paragraph of the post, and the lack of a visual editor for it makes it not comfortable to work with.
What was the feature about, and what is the problem with it?
We were requested to allow links to not be removed when excerpts are generated automatically. This by itself was never too hard to do, but we found that it is hard to define what is the content in this context because wordpress have two concepts of content, the raw content saved in the database, and the content which the reader sees after all shortcodes have been evaluated and other plugins manipulated it.
We can not just ignore the shortcodes because themes are doing all kind of strange thing with them and ignoring them might hide some content, but if you do evaluate them you end up with ads, share buttons and other things that are obviously not part of an excerpt.
It is just too hard to make a general solution that will work with all themes and plugins.
But what about the users already using it?
We are going to add a filter that will let advanced users the ability to write some simple (or complex) code to customize the excerpt, and do it while targeting the category posts widgets in general and even a specific widget.
The filter name is “cpw_excerpt” and it provides 3 parameters which can be used when calculating a new excerpt. Following are two examples of possible ways to use it.
The first example is an actual working plugin that adds an additional editor in the post editting screen that can be used to add excerpt specific to the category posts widgets
Keep in mind that this allows people to add raw html, therefor it is not very secure in a multi author enviroment where you do not trust your authors
The second example just shows the concept of how it is possible to target a specific widget