0

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.com/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.com/XmXRYui7

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

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.

1
  • Thank you Shivanand for your help with this. I tried adding add_filter('get_site_icon_url','__return_false', 10, 3); but it did not remove it. I am not certain whether it needs to be added to the functions file of the site displaying the link or the site the link is coming from, but I added it to both. Both sites are on a WP Multisite install. I am editing the functions.php file in for the theme that corresponds to each site. The fact that I have tried four different ways with no results leads me to believe I am doing something wrong, but I am having trouble figuring out what. – Web Canvases Apr 6 '17 at 17:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.