WordPress added oEmbed provider support in v4.4.0, allowing users to easily embed posts by copying a WordPress post URL and pasting it into the WordPress editor.
WordPress 4.5.0 made further enhancements to the embed template for easier customization for theme developers.
In BuddyPress 2.6.0, we are piggybacking off this functionality and enabling oEmbed provider support for single activity item.
This means you will be able to embed single activity items by copying the activity permalink and pasting it into the WordPress editors.
Your WordPress version is 4.5 or higher, you can enjoy the Activity Embeds feature we’re introducing in BuddyPress 2.6!https://videopress.com/v/VwVrGm7a?hd=1– Paul Gibbs (@djpaul) June 15, 2016
This feature will require WordPress 4.5+.
Disabling Activity Embeds
If you do not want your BuddyPress site to have activity embeds enabled, you can disable the feature with this small code snippet:
add_filter( 'bp_is_activity_embeds_active', '__return_false' );
Media in Activity Embeds
If an activity item includes a URL from a registered WordPress oEmbed provider on its own line:
We will attempt to display an image and caption of that oEmbed item in the activity embed template.
If a URL from a registered WordPress oEmbed provider isn’t found, we will attempt to embed an inline audio or video URL using your browser’s native HTML5 player.
Information for Theme Developers
As a theme developer, if you do not like the default look of activity embeds, you can override any of the template parts located at
/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/assets/embeds/ by copying them to your theme’s directory.
Let’s say I want to make some tweaks to the activity header embed template part, copy
/wp-content/themes/YOUR-THEME/buddypress/assets/embeds/header-activity.php and make your changes.
If you want to override the CSS, copy
/wp-content/themes/YOUR-THEME/css/embeds-activity.min.css and make your changes.
If you have
WP_DEBUG turned on, then omit the
Note: CSS is rendered inline in the
<head> tag. This is similar to what WordPress is doing in their embed template.
Information for Template Pack developers
If you do not know what a template pack is, you do not need to read this section!
As of BuddyPress 2.6, if you are developing a custom template pack that is not bp-legacy, for activity embeds to display properly, you will need to copy the following to your template pack’s directory:
There is a proposal to eliminate this copying process in future versions. Keep an eye on the following ticket for more info:
Information for Plugin Developers
In order for oEmbed to work with BuddyPress activity items, we register a custom endpoint with the WordPress oEmbed REST API:
As well as supporting the regular oEmbed parameters like
The BP Activity oEmbed endpoint also supports the
If this is set during the oEmbed request, no media items will be displayed in the embed.