Is your feature request related to a problem? Please describe.
Shortcodes have been a core functionality of WordPress since version 2.5. As such, there is an extremely wide usage of shortcodes across plugins and themes created by hundreds(more?) of plugins and themes. This is unlikely to immediately stop with the Gutenberg editor despite growing adoption as the primary content creation tool for WordPress.
Describe the solution you'd like
I would like to see support for the Gutenberg shortcode block to be included in Block-Based Theme/Full Site Editing functionality currently being developed for inclusion in core.
Describe alternatives you've considered
This request is based on my experience working directly with long-time content creators as well as many re-theming projects for existing sites with many and varied plugins dependencies.
An alternative to the immediate removal of this functionality in Block-Based theming would be a larger and longer-term initiative to phase out shortcodes.
Related https://github.com/WordPress/gutenberg/pull/20343
cc @youknowriad @azaozz @johnstonphilip
Since block-based themes are not an existing API, we're not breaking any backwards compatibility and this more is more likely to encourage people to move away from shortcodes to blocks and formats.
An alternative to the immediate removal of this functionality in Block-Based theming would be a larger and longer-term initiative to phase out shortcodes.
As stated here, I see this as the beginning of the larger and long term phase out of shortcodes as we're not impacting any existing site while encourage folks to adopt the new technologies. Allowing them in block-based themes is likely to encourage their usage still and prevent the long phase out.
I see this as the beginning of the larger and long term phase out of shortcodes
Yes! At this point shortcodes are the WP equivalent of using HTML tables for layout :) There's absolutely no good reason to use 2007's tech in 2020. There are so many new, better ways to do things.
Yes! At this point shortcodes are the WP equivalent of using HTML tables for layout :) There's absolutely no good reason to use 2007's tech in 2020. There are so many new, better ways to do things.
I certainly can鈥檛 argue with this, it鈥檚 100% true. This leads me to consider what else could the community be doing to remove barriers for adoption of Gutenberg for content creation. Also what can be done to encourage those that use shortcodes as a go-to solution for client work because it鈥檚 familiar to move to the unfamiliar territory of building the same functionality in a block.
Incidentally my husband showed me his work website, in the public education space, the other day. It uses tables for layouts and is not likely to change anytime soon. The end of shortcodes may be farther away than it appears.
cc @annezazu
Wanted to weigh in here since I did so in Slack when this was brought up.
I see this as the beginning of the larger and long term phase out of shortcodes
I agree that not adding shortcode support to new functionality like this is a good (and necessary) step toward phasing them out. Hopefully it will encourage people to use newer better methods while working with this new system.
@azaozz I wonder if this GitHub issue would be a good place to provide more background details about this decision in more detail. While what you said here breifly touches on the "why"...
At this point shortcodes are the WP equivalent of using HTML tables for layout
...it can give the impression that they are bad simply because they are old, which isn't a great argument on its own. I wonder if we could communicate more of thinking behind this better. Would you be able to elaborate on the "why" behind shortcodes being phased out here? That way we can have a historical record of the thinking behind the decision, and people can reference what is said here if there are further questions or discussions.
I think communicating this more fully would go a long way to helping people understand.
I would also like to know more about the decision making process.
Further, I think there are some related questions regarding user experience if some blocks cannot be used everywhere. In its current iteration, there doesn't appear to be any clear delineation between what is controlled by the content and what is the template part. I did some experiments with adding a block that was either completely or partially "removed" and then moving it around on the page and the result was not ideal.
@johnstonphilip Thanks for flagging this as an opportunity to clarify vision. In digging into this, I found the following mentioned in the FAQ for Gutenberg:
https://developer.wordpress.org/block-editor/principles/faq/#should-i-move-shortcodes-to-content-blocks
However we see the block as an evolution of the [shortcode]. Instead of having to type out code, you can use the universal inserter tray to pick a block and get a richer interface for both configuring the block and previewing it. We would recommend people eventually upgrade their shortcodes to be blocks.
This made me notice that the FAQ is quite out of date and more sparse than it should be at this point! I opened this issue to start that update process: https://github.com/WordPress/gutenberg/issues/23763
To expand on what's in place though, I think there are three major reasons (and more I'm not thinking of right now) for why blocks are the future and shortcodes are being phased out long term:
Hope this provides more context :)
...It uses tables for layouts and is not likely to change anytime soon. The end of shortcodes may be farther away than it appears.
...it can give the impression that they are bad simply because they are old.
Right, I've also built dozens of websites (for friends) using tables in the late 90's. Couple are still around I think. It's not that it's bad, or that it doesn't work, but using "old tech" comes with lots of incompatibilities and limits. Don't think anybody would ever think of using tables for a new site in 2020 :)
It's similar with shortcodes in WP. Have you looked at how shortcodes work? All the regex parsing of the HTML on every page load, the limitations, the edge cases... At the same time there are new, better ways to do everything shortcodes can do, and lots more.
I wonder if this GitHub issue would be a good place to provide more background...
Totally agree! There are better ways, my bad, sorry.