#6273 closed defect (bug) (worksforme)
global $wp_embed not working on custom post type activity...
Reported by: | revolutionfrance | Owned by: | |
---|---|---|---|
Milestone: | Priority: | high | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | reporter-feedback |
Cc: |
Description
Hello, I am not in any way an expert at bp, but I am trying to get youtube embeds to work on my video custom post type in buddypress activity. I use the following code in my entry.php file:
<?php //oEmbed video $videotest = get_post_meta( $blogpost_id, '_kleo_embed', true ); // oEmbed global $wp_embed; $post_embed = $wp_embed->run_shortcode('[embed]'.$videotest.'[/embed]'); echo $post_embed; ?>
This works with the activity of a normal post, but not of my video custom post type. Is this a buddypress bug?
Change History (7)
#4
in reply to:
↑ 1
@
10 years ago
Hello, yes $videotest is a youtube url. The strange thing for me is that it works for normal posts, but not video custom post types. It seems like the iframe is being removed.
Do I still need to use wp_embed_register_handler if I am using embeds already handled by wordpress?
Yes, the custom post type activity is registered using the post types activities from 2.2. The code that I shared is from my entry.php file.
Sorry for using the trac for this, but I'm just not sure where the bug is, since the exact same code works for posts, but not video CPT, can't seem to get to the root of it. Which way would you recommend to try to embed in entry.php?
Funny we communicate in English although we're both French ;-)
#5
@
10 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
Yes it's funny. But it's important we do so in order to let everybody understand this discussion :)
1/ I don't think you need the code you shared, and i'm not sure editing the entry.php is a good solution.
2/ you simply need to make sure the url is inside the post content
4/ I'd say it's not a BuddyPress bug and i will close this ticket as 'worksforme'.
If you wish to carry on this discussion, i advise you to open a support topic on https://buddypress.org/support . You can add an @imath
mention if you want me to bring you my support.
Hello,
I'm not sure it's a BuddyPress bug. I'm using
$wp_embed
for one of my plugin (BuddyDrive) and it's working fine. In this plugin, i'm usingwp_embed_register_handler
see https://github.com/imath/buddydrive/blob/master/includes/buddydrive-component.php#L316What would be an example of the content of
$videotest
? is it an url ?Why do you need to use the WP_Embed->run_shortcode method ?
How the activity of your custom post type is generated ? using the post type activities introduced in 2.2 ? see https://codex.buddypress.org/plugindev/post-types-activities/
BuddyPress is using a specific class
BP_Embed
which extendsWP_Embed
and which is used in the different BuddyPress parts (activity entry, message entry...)