admin管理员组

文章数量:1334818

I am trying to remove the default WordPress icon that displays on oembed links when there is no site icon. Here is a link to the site(3 links at the bottom) /. I have tried altering the code from the embed_site_title_html function and adding it to my theme's functions.php file. This is how I added it:

function groovy() {
$site_title = sprintf(
esc_url( home_url() ),
esc_html( get_bloginfo( 'name' ) )
);
$site_title = '<div class="wp-embed-site-title">' . $site_title . '</div>';

return $site_title;
}
add_filter( 'embed_site_title_html', 'groovy', 10, 2 );

I removed the code that linked to the icon. It did not work. I also tried using CSS to hide it with this code:

add_action( 'embed_footer', 'embed_custom_footer_style' );  
function embed_custom_footer_style(){ ?>
<style>
  .wp-embed-site-icon {
    display: none;
  }
</style>

I also copied the embed-content.php file from the includes folder and removed the icon image. Here is a link to the file in pastebin:

I am stumped as to why nothing seems to be working.

I am trying to remove the default WordPress icon that displays on oembed links when there is no site icon. Here is a link to the site(3 links at the bottom) https://libsource/library-as-a-service/roadmapping-and-consulting-services/library-resource-analysis/. I have tried altering the code from the embed_site_title_html function and adding it to my theme's functions.php file. This is how I added it:

function groovy() {
$site_title = sprintf(
esc_url( home_url() ),
esc_html( get_bloginfo( 'name' ) )
);
$site_title = '<div class="wp-embed-site-title">' . $site_title . '</div>';

return $site_title;
}
add_filter( 'embed_site_title_html', 'groovy', 10, 2 );

I removed the code that linked to the icon. It did not work. I also tried using CSS to hide it with this code:

add_action( 'embed_footer', 'embed_custom_footer_style' );  
function embed_custom_footer_style(){ ?>
<style>
  .wp-embed-site-icon {
    display: none;
  }
</style>

I also copied the embed-content.php file from the includes folder and removed the icon image. Here is a link to the file in pastebin: https://pastebin/XmXRYui7

I am stumped as to why nothing seems to be working.

Share Improve this question asked Apr 6, 2017 at 12:51 Web CanvasesWeb Canvases 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Here's the code to remove the site icon markup from embeds:

add_filter('get_site_icon_url','__return_false', 10, 3);

If you want to remove the entire site-icon + site-title then use this:

add_filter('embed_site_title_html','__return_false');

The right thing to do though would be to upload your own site-icon in the WordPress customizer and show-off your branding. Min image size it needs is 512px.

本文标签: embedRemoving WordPress Icon from oembed link footer