Home » WooCommerce: How to Write Shortcodes Without Outputting Content?

WooCommerce: How to Write Shortcodes Without Outputting Content?

by Tutor Aspire

When I write tutorials like WooCommerce Separate Login & Registration Pages I often need to “write” on the screen the actual shortcode – but I don’t want the shortcode to output content!

For example, if I write [woocommerce_my_account] it’s guaranteed you won’t see “[woocommerce_my_account]“… you will see Business Bloomer’s My Account page content instead!

So there is a great workaround for those of you who write tutorials, snippets and WordPress articles and need to print the actual shortcode on the screen, without making it “process” its content and outputting it.


Use double square-brackets instead of single ones

I searched online and actually found a very neat way to “write” shortcodes, without messing up with the output.

The great news is that the reader won’t see them: the output will have single square-brackets, but the shortcode won’t output the content.

If you want to “print” a shortcode on the screen (and this is valid for ANY EXISTING WordPress and third party plugin & theme shortcodes), use:


Once you write that in the WordPress content editor, you will see this on the screen:


If the shortcode does not exist, the screen will feature double quotes, as there is nothing to output:


You may also like