Best practice for db table use in a plugin
-
Hi, I’m writing a plugin that will allow authors to be assigned to categories manually – allowing authors to be defined in groups. Assignment will be done on the category editing page by checking-off authors from a list. There will be 100± authors and 7-12 categories.
I’ll be needing to display a list of authors for a particular category and, separately, to display the categories to which an author is assigned.
As I see it there are 2 options for the table structure I’d use:
1) Create a table which stores an array of assigned author id’s to a category and then add a column to the wp_users table which will store an array of category id’s for each user.
2) Create a table that has a column for each category and a row for each author. These would be added dynamically whenever a category was edited to assign authors.
I’d be really grateful for any guidance or suggestions, perhaps I’m missing some important info? I’m relatively new to WordPress…
Thanks in advance!
The topic ‘Best practice for db table use in a plugin’ is closed to new replies.