This post is here mostly as I expect to forget this tidbit. Human memory freshness dwindles exponentially.

Over in my work at the OpenETC I wrote a guide for using the Display Posts plugin.

This most handy plugin lets you take control of where and how to display dynamically a list of posts, rather than just what WordPress or a theme gives you (within category! With/Without excerpt! in reverse order! random posts! random! Custom posts types with a specific taxonomy authored by one person).

These are rendered dynamically where a placeholder is put in the post, aka a WordPress shortcode. These things in brackets [[some_shortcode_that_does_something]] are how one inserts H5P content in, a WordPress Gallery, and much more.

I went a little bonkers in that post, which led to some cussing at the Block Editor, on how to do exactly what I did above- how to I show a shortcode without it doing it’s thing?

I tried using the HTML substitutes for the [ and ] characters, or [ and ]. It works in preview, but when published, WordPress decides to make them brackets, and then.. shortcode replacement occurs.

The same happened for using pre tags in a Custom HTML block and also the Code block.

It was taking me longer to show how to display a shortcode than to write about it. The answer was a Homer SImpson head-slapping DOH found in StackExchange (where most answers live to be google).

Double brackets.

You see, if I enter something between brackets that WordPress does not have a matching shortcode for, it just shows as text:

[no_shortcode_matches_here adjective="nifty"]

So that means if I put a shortcode inside shortcode brackets, it does not match! Hence, I was able to provide an example of a shortcode in my post:

[[display-posts posts_per_page="5" orderby="rand"]]

Pretty trivial, but now I have a bit of data here in my Outboard Brain.

Featured Image: This is how I felt on finding the obvious solution I should have known!

3/52 Weeks of Baxter - Special Delivery
3/52 Weeks of Baxter – Special Delivery flickr photo by Au Kirk shared under a Creative Commons (BY) license

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.


  1. I like that solution!

    I can’t recall how I dealt with this in the past but that’s the most pleasant way I’ve seen by far.

Leave a Reply

Your email address will not be published. Required fields are marked *