最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

functions - How to remove the embed_footer?

programmeradmin4浏览0评论

I'm trying to remove the entire embed_footer from WordPress embedded posts.

By adding the following code in the functions.php, I was able to remove the site title and comments icon. But still, the share icon is there.

add_filter('embed_site_title_html','__return_false');
remove_action( 'embed_content_meta', 'print_embed_comments_button' );

Is there a way to remove the entire embed_footer? Or can I remove the share button also like the above code?

I'm trying to remove the entire embed_footer from WordPress embedded posts.

By adding the following code in the functions.php, I was able to remove the site title and comments icon. But still, the share icon is there.

add_filter('embed_site_title_html','__return_false');
remove_action( 'embed_content_meta', 'print_embed_comments_button' );

Is there a way to remove the entire embed_footer? Or can I remove the share button also like the above code?

Share Improve this question edited Jan 5, 2020 at 12:02 Libin asked Jan 4, 2020 at 16:11 LibinLibin 2761 gold badge4 silver badges13 bronze badges 2
  • If the action was created using a specific priority value I think you'll need to pass the same value when removing it for it to work. – cstrouse Commented Jan 5, 2020 at 7:13
  • It's loaded inside wordpress core files.: developer.wordpress.org/reference/hooks/embed_footer – Libin Commented Jan 5, 2020 at 12:03
Add a comment  | 

2 Answers 2

Reset to default 0

The comments button and the share button are generated in two separate default actions, so you have to remove them both:

remove_action( 'embed_content_meta', 'print_embed_comments_button' );
remove_action( 'embed_content_meta', 'print_embed_sharing_button' );

All the javascript files are embedded in the footer if you remove the footer maybe your site goes down. There are two ways:

  1. Create a child theme and create footer.php and call wp_footer(); hook there.
  2. Or If you just want to remove the footer text you can do this in CSS just find the class or id and make it display: none;
发布评论

评论列表(0)

  1. 暂无评论