From the document of embed_content
:
Prints additional content after the embed excerpt.
But I don't know which content it will print. Does it take any arguments?
From the document of embed_content
:
Prints additional content after the embed excerpt.
But I don't know which content it will print. Does it take any arguments?
Share Improve this question edited Sep 23, 2019 at 7:36 Star Light asked Sep 23, 2019 at 7:29 Star LightStar Light 518 bronze badges 2- No, the hook doesn't pass any arguments to the hook's callbacks. And you can use that hook to display something after the embed excerpt is displayed. – Sally CJ Commented Sep 23, 2019 at 7:56
- @SallyCJ Do you have examples? I quite don't understand the 'embed excerpt'. – Star Light Commented Sep 23, 2019 at 8:44
1 Answer
Reset to default 1No, WordPress does not pass any arguments to the hook's callbacks. And you can use that hook to display something after the embed excerpt is displayed. But this is of course, if the theme is using the default embed template for post embeds — with custom template, you could, if you want to, display the entire post content.
And the embed excerpt is really an automatic or manual excerpt of the content of the embedded post — see examples below.
Code Sample
// No arguments passed to this callback.
function my_callback() {
// Here, you can use the_xx functions like the_ID().
echo '<p><b>This is the additional content.</b></p>';
}
add_action( 'embed_content', 'my_callback' );
Preview 1: Embedding a post having an auto-generated excerpt
Preview 2: Embedding a post having a defined/manual excerpt
So in both previews, the "This is the additional content." was added via the embed_content
hook.