Site icon Hip-Hop Website Design and Development

Learn how to protect HTML from posts in RSS feed

I’ve arrange a pattern publish with a couple of completely different HTML tags. That is the markup, copied from the block editor:

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph -->
<p>That is paragraph 1.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In a brand new paragraph, we start an unordered listing:</p>
<!-- /wp:paragraph -->

<!-- wp:listing -->
<ul><li>listing merchandise 1</li><li>listing merchandise 2</li><li>listing merchandise 3</li></ul>
<!-- /wp:listing -->

<!-- wp:picture {"id":418,"sizeSlug":"full","linkDestination":"none"} -->
<determine class="wp-block-image size-full"><img src="https://domain.tld/wp-content/uploads/2018/11/logo.png" alt="" class="wp-image-418"/><figcaption>group emblem</figcaption></determine>
<!-- /wp:picture -->

<!-- wp:html -->
Start customized HTML
<br><hr><a href="#">hyperlink trial</a><br>
<div><p>This can be a paragraph in a div</div>
<!-- /wp:html -->

<!-- wp:paragraph -->
<p>Every</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>of</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>these</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>phrases</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>is</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>a</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>paragraph</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

Checking on my feed, it exhibits description and content material:encoded parts like the next:

<description><![CDATA[This is an excerpt]]></description>
<content material:encoded><![CDATA[<p>This is paragraph 1. In a new paragraph, we begin an unordered list: list item 1 list item 2 list item 3 Begin custom HTML link trial This is a paragraph in a div Each of these words is a paragraph...</p>
<p><a href="https://domain.tld/sample/" rel="nofollow">Source</a></p>]]></content material:encoded>

Clearly some mechanism is stripping all of the HTML and wrapping the plaintext of the publish in a single <p> – however I am struggling to seek out what it’s.

I positioned a print_debug_backtrace() on the high of feed-rss2.php and received the next:

#0  require_once() known as at [/home1/foo/public_html/wp-includes/template.php:770]
#1  load_template(/home1/foo/public_html/wp-includes/feed-rss2.php) known as at [/home1/foo/public_html/wp-includes/functions.php:1623]
#2  do_feed_rss2() known as at [/home1/foo/public_html/wp-includes/class-wp-hook.php:305]
#3  WP_Hook->apply_filters(, Array ([0] => ,[1] => rss2)) known as at [/home1/foo/public_html/wp-includes/class-wp-hook.php:327]
#4  WP_Hook->do_action(Array ([0] => ,[1] => rss2)) known as at [/home1/foo/public_html/wp-includes/plugin.php:470]
#5  do_action(do_feed_rss2, , rss2) known as at [/home1/foo/public_html/wp-includes/functions.php:1585]
#6  do_feed() known as at [/home1/foo/public_html/wp-includes/template-loader.php:48]
#7  require_once(/home1/foo/public_html/wp-includes/template-loader.php) known as at [/home1/foo/public_html/wp-blog-header.php:19]
#8  require(/home1/foo/public_html/wp-blog-header.php) known as at [/home1/foo/public_html/index.php:17]

I’ve additionally arrange a customized debug web page and stepped via what I noticed as the decision stack of the <content material:encoded> component. These assessments all got here again with the specified HTML and not one of the WP content material feedback.

Admire any enable you to all can ship my method

Addendum: The top objective right here is to allow MailChimp’s RSS merge to choose up these posts and ship them, collectively, in a periodic e mail with out the necessity to duplicate efforts. I am conscious of the constraints of HTML in e mail, all posts will probably be very simple markup however I would like not less than to have paragraph breaks.
I am fairly certain my use case obviates utilizing the API.
With the markup being wrapped in CDATA I do not anticipate to run afoul of RSS validation.

.