I’m starting to tweak wordpress a bit, and I came round an issue. Despite my hours googling and reading I can’t seem to find an answer to my question, solution to my problem.
As you know, you have to name a field when you create a new custom field, and a key is then generated. Whenever you update a field name, the key stays the same. I use groups to offer a simple layout where I don’t need to scroll to wiew all my fields. Instead, I work with some tabs.
What exactly is this key for? I can manage to get a field value by it’s key value (or at least I can’t get a field in a group value from that key).
That means that I am now setting everything up, I code my plugin and my theme according to the following : get_field( 'group_subgroup_fieldname, $post_id, false ); and it works fine.
However, if I ever change my field name, all my plugin, working only with the said field name hierachry, is now broken. Whereas if the key was used, it woud still be working fine.
Am I missing a step ? Or is that the normal way to go and I’ll have to live with some fieldname now irrelevant ?
You can’t rename a field after it is in use. When you do the meta key of the field changes and that new meta key has not value saved. Field names should not be changed when in use and you should continue to use the old field name.