Storing image gallery plugin data

I’m making image gallery plugin and I’m not sure what is the best way to store data in WordPress. Plugin can contain multiple gallery instances with some options and each gallery contains images with options. Gallery can be added to site using simple shortcode, something like this: [mygallery id=”gallery1″].

So should I use add_option() and store all data in one field or just create two tables for galleries and gallery items?

Thanks for advice.

2 Answers
2

Depends on what you want to store.

  • The Settings API uses it’s own, well performing, engine behind Tutorial
  • You can (miss)use the Theme modifications API as well
  • Or, if it you’re talking about adding data to posts, you can use the Post Meta Storage Engine

Note: “Post Meta Storage Engine” is no official term. I just used it to surround/house the public API/functions set in a nice name.

Leave a Comment