Programmatically create xprofile field
-
Hi there,
I try to make sure that there is a certain xprofile field existing.
It seems like that is a tough thing to do with BuddyPress, right?
I am used to ACF where registering fields is quite easy.
If I get it right xprofile fields are registered directly in the database.
So the “xprofile_insert_field” function tries to write a line in the database.That means that I can not guarantee that a field has a certain ID and so I would need to focus on the name.
But the name seems to also be the Title of the field. So if I need to change the title of the field everything falls apart. Do I see that correctly?!I now plan to give the field a defined id and maybe overwrite the field.
Which is very messy and just works if I do huge id jumps for every field that i need, so that field that are manually created will not be missed.Is there a clean way to set up fields programmatically?
We deploy our site with a tool and so the wish is that eg. a new staging site can be created without manual work.
Also fields should be updated through code not manually.
So if the Title of the field needs to be changed I would like to have that updated through code.Hm – should I use some kind of databank migration thing for that?
Maybe you have tipps for me.
- You must be logged in to reply to this topic.