[wp-hackers] Shortcodes and formatting

Andy Skelton skeltoac at gmail.com
Tue Apr 1 22:55:19 GMT 2008


>  > That will work well except when the content is exported from one blog
>  > and imported in another/new installation. The array with the old
>  > shortcodes wouldn't be in the new db.

Someone deactivates a plugin, their shortcodes are nulled. That's
going to be a rare occurrence. If they then move and the nulled
shortcodes appear again, I am willing to let that happen in that case.
Almost all options are lost in a move. It's not hard to copy an option
manually or write a plugin to null an unused shortcode.

Another plugin idea: retroactively convert certain shortcodes to their
HTML and save this in post_content. That would let you disable a
shortcode plugin without losing previously-saved content.

The way I wrote the Quiz plugin, it never stores the shortcode in
post_content. To ensure the shortcode containing the question and
secret answer never appear on the blog, it strips out the shortcode
and stores it in postmeta. In this case it doesn't matter that the
shortcode's position in the post is lost. It is added to the end of
post_content when filtered to edit, then stripped out again when
filtered to save.

>  For example, if the shortcode format is <!--[shortcode]--> or
>  <!--[shortcode ...]...[/shortcode]-->, in TinyMCE we can easily filter
>  <!--[ to <pre>[ (or any other tag) on input and filter it back to <!--[
>  on saving/switching to HTML mode. It can also be filtered to
>  &lt;!--[shortcode]--&gt; and back to <!--[shortcode]-->, etc.
>
>  The standard <![CDATA[ ... ]]> can also be used.

It's a bit late for this IMO. The format has been around for years and
in trunk for months.

Andy


More information about the wp-hackers mailing list