0

Im trying to get my Budypress site to work with wp_editor on profile fields. So far everything is ok but my tags are being striped.

I added the following:

add_filter( 'xprofile_allowed_tags', 'custom_xprofile_allowed_tags' );

function custom_xprofile_allowed_tags($tags){

$tags['li'] = array();
$tags['ul'] = array(
'type' => true  
);  

return $tags;

}

But it still saving my profile field without <ul><li>

I know the filter is working because if i add unset($tags['strong']); the strong tag is stripped.

Thanks for the help

4

1 回答 1

0

我的代码运行良好,我没有意识到我还需要更改过滤器以显示数据。所以我的代码是:

function xprofile_with_html() {
    //change allowed tags to use the same as posts when save
    add_filter( 'xprofile_allowed_tags', 'custom_xprofile_allowed_tags',0 );

    //remove wp_filter and add custom one when showing in edit field
    remove_filter( 'bp_get_the_profile_field_edit_value',      'wp_filter_kses',       1 );
    add_filter( 'bp_get_the_profile_field_edit_value', 'my_custom_profile_filter',0,3 );

}
add_action( 'bp_init', 'xprofile_with_html' );

function custom_xprofile_allowed_tags($tags){

    global $allowedposttags;
    return $allowedposttags;

}

function my_custom_profile_filter($data){

    return xprofile_filter_kses($data);     

}

有了这些,我可以将 wp_editor 用于我的 xprofile 字段

于 2013-07-30T16:51:34.227 回答