BP_Core_oEmbed_Extension::filter_embed_url( string $retval )
Pass our BuddyBoss activity permalink for embedding.
Description
See also
Parameters
- $retval
-
(Required) Current embed URL.
Return
(string)
Source
File: bp-core/classes/class-bp-core-oembed-extension.php
public function filter_embed_url( $retval ) {
if ( false === isset( buddypress()->{$this->slug_endpoint}->embedurl_in_progress ) && ! $this->is_page() ) {
return $retval;
}
$url = $this->is_page() ? $this->set_permalink() : buddypress()->{$this->slug_endpoint}->embedurl_in_progress;
$url = trailingslashit( $url );
// This is for the 'WordPress Embed' block
// @see bp_activity_embed_comments_button().
if ( 'the_permalink' !== current_filter() ) {
$url = add_query_arg( 'embed', 'true', trailingslashit( $url ) );
// Add custom route args to iframe.
if ( ! empty( buddypress()->{$this->slug_endpoint}->embedargs_in_progress ) ) {
foreach( buddypress()->{$this->slug_endpoint}->embedargs_in_progress as $key => $value ) {
$url = add_query_arg( $key, $value, $url );
}
}
}
return $url;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.6.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.