2) Shortcode

Edit your test post to run a plugin. Find the Shortcode block under Widgets.

Add the shortcode API and then Update your test post.

Go to the Plugin Editor. We’re going to cannibalize the Hello Dolly plugin that comes as default with every installation.

Delete everything except the Plugin Name, and change that to “My Table”.
Create the shortcode’s function after the add_shortcode function.
Paste the HTML text string as the function’s return value.
Activate the My Table plugin. * **
Refresh the test post.
Notice that the two tables are identical.

* The reference to “a new version of My Table” is actually a reference to Hello Dolly, somehow remembered by core. If you click “update now”, all the code for the Hello Dolly plugin will revert back.

** Note: It is possible to modify and update the plugin code while it is active, and still get the shortcode in the post to display as you’d expect. But, sometimes you’ll get an error. If that happens, open another window, deactivate the plugin, then go back and update the code.

For your future reading pleasure: