I have setup my plugin’s table to use $wpdb->prefix but aside from that are there any conventions that you should name them;

Maybe $wpdb->prefix.'plugin_'.$tablename or something.

I can’t find any documentation and the examples of plugins I have used in the past don’t seem to adhere to anything in particular.

1 Answer
1

I’d say (and that’s just my opinion), that prefixing global available stuff like:

  • functions
  • classes
  • tables

should always share the same prefix. Aside from making your code more unique & therefore collision save, it helps when searching for plugin code, plus it serves as branding for your plugin too. Adding plugin_ to the table name seems like a valid and honorable idea, as it makes the Qs “Does it come from a theme, or a plugin? Where do I have to search for it?” obsolete.

Leave a Reply

Your email address will not be published. Required fields are marked *