WordPress字符串常量是否有标准或编码标准?

I have a set of options I want to store in a WordPress plugin and these names are likely never to change. However, I want to account for the eventuality that they do.

If myplugin is the name of the plugin I'm developing, I have an 'option names' named in the following style:

  • myplugin_preference_name
  • myplugin_preference_address

That sort of thing.

Anyway, there doesn't appear to be any sort of authority on whether using a PHP define() call is ok in this case or not (in the context of a WordPress plugin).

I have already had a look through the wordpress coding standards:

http://codex.wordpress.org/WordPress_Coding_Standards

Constants in Wordpress are normally written UPPERCASE.

You do not find that in the coding standards, because wordpress coding standards are historically weakly documented and enforced, I would not rely too much to that document.

Also you should consider to not introduce constants too much. Not everyhing you can use a constant for, needs to be one, normally variables already do a good job.