WordPress.org

Ideas

Keep shortcodes in the RSS summary feed

  1. John-Pierre Cornelissen
    Inactive

    12345

    WordPress keeps/processes shortcodes for the full text feed, but removes them from the automatic excerpt in the summary feed.

    If you use a page builder theme, everything is wrapped inside a shortcode, so the summary feed is always empty.

    I think the RSS feed should always contain the actual text that is also displayed when you visit the article. That means that shortcode output should also be included.

    Posted: 6 months ago #
  2. Ipstenu (Mika Epstein)
    Administrator

    The page builder should be able to fix that for their code. The problem with just allowing them ad hoc is that they need to display 'differently' for each setup, and it may not be straightforward. Have you asked the page builder to accommodate RSS?

    Posted: 6 months ago #
  3. John-Pierre Cornelissen
    Inactive

    12345

    Yeah I have, it's an ongoing ticket but they say "shortcodes are a part of WordPress and not something Divi-related, it's WordPress that doesn't support them." (Divi is the theme builder I use). Their proof is that it also doesn't work with the 2017 theme if they add content with shortcodes.

    To that I must agree with them. If you do a Google search around this, you also see reports from people that loose for example the first character of a post because they wrap it in a shortcode to create a drop caps.

    I understand that this can be fixed with custom code in a theme, but the main question here is why WordPress removes shortcodes from the summary feed with auto excerpt in the first place. It doesn't do that for the full text feed either. It's not consistent behaviour and strange to then expect every theme developer to fix an issue that is caused by WordPress.

    Is there a reason someone decided to remove shortcode from the auto excerpt?

    Posted: 6 months ago #
  4. Ipstenu (Mika Epstein)
    Administrator

    I'm sorry! I miss-understood which part of the RSS summary you were talking about.

    See... Shortcodes totally do work. When you custom make an excerpt. There are three things here:

    1) shortcodes work fine in RSS, and if they don't, there's something else wrong.

    2) Shortcodes DO NOT work in the autogenerated post excerpts, which many people (but not all) use in RSS feeds.

    3) Shortcodes and html CAN work in customized excerpts.

    You appear to be meaning the second one. To which, yes, you're right, the except strips out everything (html tags too) when it's auto-generated.

    You can totally make this work with filters, but the reason WP does that is actually because of page generators like Divi. That is, you may end up with a 55 word excerpt that is ALL shortcode. WordPress would then spit back a totally useless excerpt that was incomplete. In order to avoid that, it strips out all the shortcodes and HTML and puts in plain, raw, text.

    Similarly, if you use the custom except, you may notice it's raw HTML only. That's also to prevent shenanigans and display issues.

    In your case, you have a couple choices.

    1) Make a custom excerpt by hand. I personally recommend this one, as it gives you the most control, but ALSO is better for your SEO

    2) Use filters to allow shortcodes and such in auto-generated excerpts. If you do this one, please TEST first, as you may see some unexpected results.

    Posted: 6 months ago #
  5. John-Pierre Cornelissen
    Inactive

    12345

    Yes, I mean the second one.

    Why would WordPress "spit back a totally useless excerpt that was incomplete."?

    It doesn't do that for the full rss feed either. That one is completely legible.

    The auto generated excerpt should be the same as the full feed, except limited to 55 characters.

    You get that if you would first process the shortcodes, then (maybe) strip out the html tags and then limit to 55 words*. Not the other way around, then you get what you said.

    * there should also be a setting for the number of words.

    Posted: 6 months ago #
  6. Ipstenu (Mika Epstein)
    Administrator

    Why would WordPress "spit back a totally useless excerpt that was incomplete."?

    Because without processing the whole post, via Divi, there's no way for it to be absolutely sure what content is ... well ... content. So Divi would have to tell it "THIS is content" in a way the RSS reader would parse.

    Good news for you, though. Someone JUST made a plugin that does this! It should be up soon :)

    Posted: 6 months ago #
  7. NCBI Lara Nozze
    Member

    How do I know when the plugin is ready, Mika?

    Posted: 6 months ago #
  8. Ipstenu (Mika Epstein)
    Administrator

  9. John-Pierre Cornelissen
    Inactive

    12345

    @Ipstenu

    Because without processing the whole post, via Divi, there's no way for it to be absolutely sure what content is ... well ... content. So Divi would have to tell it "THIS is content" in a way the RSS reader would parse.

    I am sorry but that's a bad 'Excuse', WordPress already does it for the full text feed, so the question still is: why doesn't it do the same thing for the summary feed (and then limit the number of characters like I mentioned in my previous reply).

    Thanks about the plugin link. I have been talking with the developer Jerry in a Divi Facebook community about this. So here is your proof that other people also think this is an issue with WordPress and page builders.

    It's great to have this as a workaround but the problem remains that this is a WordPress issue in the first place that should really be fixed at the source: WordPress. That way it will also be solved for other page builder themes.

    Like I said before

    I understand that this can be fixed with custom code in a theme, but the main question here is why WordPress removes shortcodes from the summary feed with auto excerpt in the first place. It doesn't do that for the full text feed either. It's not consistent behaviour and strange to then expect every theme developer to fix an issue that is caused by WordPress.

    So how is this issue going to be considered for a future WP update?

    Thanks
    JP

    Posted: 6 months ago #
  10. Ipstenu (Mika Epstein)
    Administrator

    Nothing is an excuse. It's an explanation of how code works.

    Look. Remember, you're only getting 55 WORDS in an auto-excerpt. What happens when that word is the middle of a shortcode?

    Like it ends at [embed] and doesn't include the rest? It would break the feed and the content. And that's going to happen a LOT with your page builders that use shortcodes.

    In order to prevent systems from working too hard (and making your site slow) by processing the WHOLE post and then extracting what's needed, WP strips shortcodes and HTML from the auto-excerpt.

    It's 100% consistent behaviour. It's always been that way. All theme devs (especially shops like Divi) know and expect this to be the case.

    The full feed doesn't strip because it's going to show everything. The short feed, because it truncates, MUST strip to provide optimum compatibility with ALL the millions of shortcodes someone might be using in a post.

    Since WP can't magically know what your shortcode is meant to do (remember - you're adding on a shortcode to WP, not the other way), it's the burden on the theme dev to come up with a solution.

    The fix needs to be on Divi's end. And you're lucky enough that some soul made you a plugin :)

    Posted: 6 months ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    1 Vote
  • Status

    This is plugin territory