Home Forums General Issues Best practice for naming the fields Reply To: Best practice for naming the fields

  • I tend to use the second example, where the prefix matches the slug of the CPT I’m using them on. book_authour etc. On options pages I use a prefix that indicates the type of option it’s for, for example site_options_field_name. I have, in the past used a prefix that represented the client, but I stopped doing that when I started reusing field groups and needed to rename them all to match another client.

    To be honest, I don’t think that there is a “standard WordPress practice” except that the top level fields should have a prefix and I try to make sure that my field names will not conflict with any of the more popular plugins, and I like using things that will be reusable.