Skip to:
Content
Pages
Categories
Search
Top
Bottom

create xprofile fields from plugin

  • @sandorastarita

    Participant

    Hello, I’m trying to create xprofile fields from my plugin code, and not from admin interface. Is this possible? Can somebody help me?

    working with WP 4.7.2 and buddypress 2.8, with Onesocial Marketplace theme.

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @henrywright

    Moderator

    I believe xprofile_insert_field() will insert or update a profile field. Here’s an example of how to use it:

    $f = xprofile_insert_field( array(
        'field_group_id' => 8,
        'type'           => 'textbox',
        'name'           => 'Foo',
        'is_required'    => false,
        'can_delete'     => false,
        'description'    => 'This is a description.'
    ) );

    On success, $f will be the ID of the new field.

    @sandorastarita

    Participant

    Thank you very much!!!

    @darunia77

    Participant

    Hello, @henrywright, is this code to be used instead of an xprofile plugin?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar