Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
2  
You should use unique name. –  Mohit Bumb Oct 11 '11 at 11:42
1  
Thanks for your answer Mohit, a unique name is required, the table wouldn't create properly if you didn't use a unique name. –  Toby Oct 11 '11 at 12:33
1  
No its created but if old table exists then it update with your new table so maybe few functionality, plugin or any theme stop working or maybe full functionality too. –  Mohit Bumb Oct 11 '11 at 12:38
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.