[wp-hackers] shortcode API > $content > TINY MCE filters

Haluk Karamete halukkaramete at gmail.com
Thu May 15 00:38:41 UTC 2014

Thanks Xavier, for your detailed response.

I ended up doing the following old-->new replacements and that set seemed
to take care of my structured-data issue. Now I am retriveing it exactly as
how I entered it.

& -->  &
<br /> -->    "\n"
</p> -->
<p> -->

– -->  -
‘ -->  '
” -->  "

// incase visual tab to text tab thing took place, the following takes care
of that problem

& --> &
&gt -->      >
< -->      <

On Wed, May 14, 2014 at 3:43 PM, Xavier Faraudo i Gener <
wordpress at web-warlocks.net> wrote:

> Hello,
> The filters for content are tricky, specially wptexturize and wpautop.
> (Which, if I don't remember it wrong, sets single line breaks to br tag,
> and doubles to p tag.) Removing them is IMHO a very bad idea, but setting
> them to another priority may be useful in some cases. You're risking
> conflicts with other author's plugins and shortcodes, though.
> I've been toying with shortcode system for a bit now (doing things like
> the BBCode syntax of [code=value /] or nesting the very same shortcode, for
> instance, which actually are pretty easy things to do once you look at how
> shortcode atts are parsed). For your issue with "structured data" into
> shortcodes, I'd suggest to structure the params in a semantically
> meaningful way, using shortcodes for params in a similar way to object and
> param HTML tags, like this:
> [complex_shortcode]
> [complex_shortcode_param_1]value 1[/complex_shortcode_param_1]
> [complex_shortcode_param_2]value 2[/complex_shortcode_param_2]
> [/complex_shortcode]
> Use then the param shortcodes to parse and *properly sanitize* values,
> store them in a global var (prefix it with underscore _ to show it's a
> private use var), and retrieve the values from the complex_shortcode
> function. Just make sure to do_shortcode *before* trying to access the
> global vars (otherwise, they won't be properly populated).
> All this, yes, is a bit like saying that if you don't like how WP filters
> your values (something totally legit, BTW), filter them yourself with your
> favo(u)rite flavo(u)r :). That's what I do and works fine for me, but "your
> mileage may vary" :)
> Note that using the params-shortcode technique, you are no longer
> constrained by order of params, may have empty/null params, &c. Which works
> great in combination with options to set defaults.
> Also, please note that:
>  (snip)
>> When my shortcode $content has the above red text, it appears in the DB as
>> follows;
>> (/snip)
> …are of little help when we're reading this list as plain text: we're
> effectively HTML color blind.
> Best,
> Xavier
> --
> Xavier Faraudo i Gener (the WordPress Web Warlock)
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list