Wordpress strips schema.org markup

851 views
Skip to first unread message

Maya

unread,
Jun 4, 2011, 12:25:01 AM6/4/11
to Schema.org Discussion
I'm working on a self-hosted Wordpress website. After marking up some
content with schema.org microdata and switching from HTML view to
visual view and back, all the markup was stripped away.

I tried searching for a solution and found several plugins that
promised to stop Wordpress from meddling with the markup but none of
them worked. I understand that switching off the visual editor
altogether may prevent the stripping from happening; however, this is
a client website and they definitely won't be comfortable working in
HTML view once we hand the website off to them.

Has anyone figured out a workaround for this kind of situation? I'm
stumped at this point.

Maya

unread,
Jun 4, 2011, 8:46:09 PM6/4/11
to Schema.org Discussion
Update:

I've found a workaround for Wordpress using shortcodes. I installed
the Post Snippets plugin which allows one to store reusable snippets
of code that can then be inserted into a post or a page as shortcodes
using the post editor or by manually typing them. This prevents
Wordpress from stripping away the schema.org markup.
It takes a little while to set up if you plan to use several schemas,
but once set up, you can export your Post Snippets and import them to
other Wordpress sites.

One more thing — the Post Snippets plugin allows you to define
variables, so you could create a snippet for <div itemscope
itemtype="{schema}"> that would allow you to replace {schema} with the
appropriate itemtype (for example, http://schema.org/Person/).

Aidan Owens

unread,
Jun 4, 2011, 8:53:41 PM6/4/11
to schemaorg-...@googlegroups.com

Very helpful! Thanks for sharing.

Ben Atkin

unread,
Jun 4, 2011, 8:58:50 PM6/4/11
to schemaorg-...@googlegroups.com
If you'd like to find out why this is happening, rather than just how to get around it, I suggest asking on Stack Overflow. It's unexpected processing that WordPress is doing, which is not specific to schema.org markup.


If you decide to ask, please post a link to the question!

Ben

Ian

unread,
Jul 3, 2011, 12:23:40 AM7/3/11
to Schema.org Discussion
search plugins for 'schema for wordpress'

Maya Blyth

unread,
Jul 4, 2011, 3:08:38 AM7/4/11
to schemaorg-...@googlegroups.com
Thanks. I actually bookmarked your site a few days ago and am planning to try it out to see how it compares to the as hoc solution that I came up with using the Post Snippets plugin. Without having yet tried it, it appears that your solution is somewhat similar, in that it also uses shortcodes, but the schema.org vocabulary is baked in.

Also, you probably figured this out, but it appears that the issue with schema.org markup and Wordpress has to do with the TinyMCE editor. A better long term solution might be to create a custom function that adds schema.org attributes as valid elements for TinyMCE . . . but then again, using shortcodes may actually be easier than using pure schema.org markup. I don't have enough experience to say which solution is more flexible/scaleable over the long run. (One of the flaws of my own solution is that it's basically limited to <div> and <span> elements. To extend it to other elements would require defining a lot more shortcodes for other HTML elements.)

Maya Blyth

unread,
Jul 4, 2011, 4:29:33 AM7/4/11
to schemaorg-...@googlegroups.com
[Correction: "ad hoc solution", not "as doc solution"]

loose...@gmail.com

unread,
Jul 18, 2011, 12:07:43 PM7/18/11
to schemaorg-...@googlegroups.com

Brazen Husseys

unread,
Aug 4, 2011, 1:05:10 AM8/4/11
to Schema.org Discussion
Google does still support Rich Snippets, though, so have you thought
of simply using that format? BTW, great idea with the shortcodes.
Also see this from a friend:

http://www.searchenginepeople.com/blog/howto-add-schema-wordpress.html



On Jul 4, 4:29 am, Maya Blyth <mjtbl...@gmail.com> wrote:
> [Correction: "ad hoc solution", not "as doc solution"]
>
>
>
>
>
>
>
> On Mon, Jul 4, 2011 at 12:08 AM, Maya Blyth <mjtbl...@gmail.com> wrote:
> > Thanks. I actually bookmarked your site a few days ago and am planning to
> > try it out to see how it compares to the as hoc solution that I came up with
> > using the Post Snippets plugin. Without having yet tried it, it appears that
> > your solution is somewhat similar, in that it also uses shortcodes, but the
> > schema.org vocabulary is baked in.
>
> > Also, you probably figured this out, but it appears that the issue with
> > schema.org markup and Wordpress has to do with the TinyMCE editor. A
> > better long term solution might be to create a custom function that adds
> > schema.org attributes as valid elements for TinyMCE . . . but then again,
> > using shortcodes may actually be easier than using pure schema.org markup.
> > I don't have enough experience to say which solution is more
> > flexible/scaleable over the long run. (One of the flaws of my own solution
> > is that it's basically limited to <div> and <span> elements. To extend it to
> > other elements would require defining a lot more shortcodes for other HTML
> > elements.)
>
Reply all
Reply to author
Forward
0 new messages