Probably through Jetpack, yet I’m not sure
Looking at your site now I can say that those open graph tags are from Jetpack
Plugin.
If there is no image available in the post , Jetpack adds site-icon/favicon as the default one.
We can control output of tags using filters
jetpack_open_graph_tags
jetpack_images_get_images
jetpack_open_graph_image_default
jetpack_enable_open_graph
Remove only og:image
Place the following code in functions.php
of the active theme.
function wpse_228649_remove_image_tag( $tags ) {
unset( $tags['og:image'] );
return $tags;
}
add_filter( 'jetpack_open_graph_tags', 'wpse_228649_remove_image_tag' );
Stating from Jetpack blog
Jetpack starts by looking for a Featured Image. If you didn’t define any, we will look for slideshows and galleries, and then for any images that may be attached to the post. If we don’t find any image attached to that post, we’ll look for single images you may have inserted in the post. If you’ve inserted an image that is hosted on another site, we can use it too.
However, sometimes you may not have added any image to your post.
In that case , we can set default image using the following code.
function wpse_203094_custom_image( $media, $post_id, $args ) {
if ( $media ) {
return $media;
} else {
$permalink = get_permalink( $post_id );
$url="YOUR_CUSTOM_DEFAULT_IMAGE_URL" ;
return array( array(
'type' => 'image',
'from' => 'custom_fallback',
'src' => esc_url( $url ),
'href' => $permalink,
) );
}
}
add_filter( 'jetpack_images_get_images', 'wpse_203094_custom_image', 10, 3 );
Or you can use filter to change the default one.
function wpse_203094_jetpack_default_image() {
return 'YOUR_IMAGE_URL';
}
add_filter( 'jetpack_open_graph_image_default', 'wpse_203094_jetpack_default_image' );
Or you can disable them entirely using:
add_filter( 'jetpack_enable_open_graph', '__return_false' );
Note
As @cjbj pointed out that some plugins like Yoast SEO
can override open graph tags. The above filters/code works only for Jetpack
assuming that no other plugins are overriding them.
Update
Is there any solution, that would allow me to block og:image tag only for favicon
Yes there is , we can use jetpack_images_get_images
filter.If we take a look at jetpack_og_get_image
src we can find that it adds core site icon like this
// Third fall back, Core Site Icon. Added in WP 4.3.
if ( empty( $image ) && ( function_exists( 'has_site_icon') && has_site_icon() ) ) {
$image['src'] = get_site_icon_url( 512 );
$image['width'] = '512';
$image['height'] = '512';
}
And finally defaults to blank image like this
// Finally fall back, blank image
if ( empty( $image ) ) {
/**
* Filter the default Open Graph Image tag, used when no Image can be found in a post.
*
* @since 3.0.0
*
* @param string $str Default Image URL.
*/
$image['src'] = apply_filters( 'jetpack_open_graph_image_default', 'https://s0.wp.com/i/blank.jpg' );
}
So as to make Jetpack assume that it has already got an image and there is no need to use site icon
, we need to set some image.This can be done using the following code.Place this in functions.php
of the active theme.
function wpse_203094_no_site_icon( $media, $post_id, $args ) {
if ( $media ) {
return $media;
} else {
return array( array(
'src' => '' // here we are conning Jetpack, Hurray!
) );
}
}
add_filter( 'jetpack_images_get_images', 'wpse_203094_no_site_icon', 10, 3 );