Skip to content

Instantly share code, notes, and snippets.

@boonebgorges
Created August 9, 2019 18:24
Embed
What would you like to do?
Enable embeds for BuddyPress xprofile field
<?php
add_filter(
'bp_get_the_profile_field_value',
function( $value, $type, $id ) {
if ( 476 != $id ) {
return $value;
}
global $wp_embed;
$value = $wp_embed->autoembed( $value );
return $value;
},
0,
3
);
add_filter(
'xprofile_allowed_tags',
function( $tags, $obj, $id ) {
if ( 476 != $id ) {
return $tags;
}
$tags['script'] = array(
'src' => 1,
'async' => 1,
'charset' => 1,
);
$tags['a']['class'] = 1;
$tags['a']['data-width'] = 1;
$tags['a']['data-height'] = 1;
$tags['a']['data-dnt'] = 1;
return $tags;
},
10,
3
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment