[wp-hackers] Idea: Widgets as custom post types

scribu scribu at gmail.com
Thu Mar 4 21:04:32 UTC 2010

> If we are planning on taking action, I agree with scribu, Austin, and Chris
> Williams' points. Regardless of which table we store widgets in, I think it
> can be agreed that widgets need to be treated like *REAL* content, and not
> some serialized meta-garbage (as they currently are). If nothing else,
> sticking widgets into the posts table makes them a lot more accessible to
> the built-in search, if needed.
> If you have 50 total text widgets on your site but are showing a page w/ 1
> text widget, all 50 are getting loaded for that page regardless. That's
> because WP needs to load the entire serialized string, de-serialize it,
> then
> decide which widget(s) it needs. +1 on Austin's point of serialized data
> getting easily corrupted.

Completely agree.

I plan to open a ticket once we discuss more about the best way to store
widget instances individually.

Since I suppose a wp_widgets table is out of the question, I don't see a
better place than the wp_posts table.

A few questions remain:

*How should the widget type be stored?*

Some ideas:

- widget taxonomy
- row in postmeta

How should the widget options be stored?*

Some ideas:

- serialized array in post_content
- single serialized row in postmeta
- separate row in postmeta for each option


More information about the wp-hackers mailing list