Skip to:

How do I remove P tag from field value?

  • I am dumping user profile data like this:


    … but the bp_the_profile_field_value function is adding paragraph (p) tags to the output.
    How can I prevent this? I can’t find where it happens in the code.

Viewing 6 replies - 1 through 6 (of 6 total)
  • We fixed this in trunk the other day. Take a look at the change here:

    @DJPaul but that was to fix the incorrect nesting of elements, the paragraph tags still exist for the bp_the_profile_field_value()

    would not something like xprofile_get_field…() be better?

    remove_filter( ‘bp_get_the_profile_field_value’, ‘wpautop’ );

    would do it but also remove the paragraph tags from all other fields

    Thanks for the help so far.
    Knowing that the extra tags were coming back, I tried to take the quick fix and strip them like this:

    …but I still get the same result — data wrapped in P tags.

    I spent some time trying to learn about the xprofile functions but I did not find a clear example that I could make work.

    Would I would like to find a loop that gives me rather tight control of what is happening.
    Perhaps like this (pseudo code):
    $user = bp_get_profile($user_id);
    for ($i = 0;$user.fields.count;$i++) {
    $field = $user.fields($i);
    echo $field->name;
    echo $field->data;

    Thanks Paul. Removing the wpautop filter gets me going for now! :)

    Profile photo of Intervik


    If someone like me found this (as always) very old topic, use the functions from edit-profile.php instead of profile-loop functions – but in the profie loop:

    instead of :

    Boink, it works for me.
    / Intervik, Lundman

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do I remove P tag from field value?’ is closed to new replies.
Skip to toolbar