Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 23,840
- How-to & Troubleshooting
- 129,892
- Creating & Extending
- 25,913
- Requests & Feedback
- 9,553
- Third Party Plugins
- 9,834
- Showcase
- 3,316
- Ideas
- 1,405
- Miscellaneous
- 9,183
-
For a plugin, instead of bp_init, use:
https://codex.wordpress.org/Function_Reference/register_activation_hook
note: I’m not sure BP is loaded before that hook is called.
Or you could use bp_init, but in your function, check for the existence of the xprofile field before you create it.
btw – you don’t need the global in that function.