In one of my other posts, Singular vs Plural WordPress Custom Post Type Permalink, I am displaying some URLs on their own line as part of the content.
However, the WordPress oEmbed functionality tries to turn URLs on their own line into a rich content preview (e.g. a YouTube URL alone on a line creates an embedded video). This includes turning a link to a page on another WordPress site into a content preview. This resulted in my post turning http://ferrarello.com/recipes/guacamole
into
Original Markup
The original markup I was using (that resulted in the WordPress content preview replacing the URL) was
<pre><code># plural
http://ferrarello.com/recipes/guacamole
#singular
http://ferrarello.com/recipe/guacamole
</code></pre>
Corrected Markup
I was able to prevent WordPress from turning the URLs into rich content by wrapping the URLs in <span>
HTML tags.
<pre><code># plural
<span>http://ferrarello.com/recipes/guacamole</span>
#singular
<span>http://ferrarello.com/recipe/guacamole</span>
</code></pre>
Leave a Reply