Viewing 1 replies (of 1 total)
  • Nimesh

    (@nimeshrathod1gmailcom)

    I have the same issue.
    But even you may be try to put the given below code in your function.php file and than try, unfortunately it has been not work for me, may be it will work for you.

    function insert_image_src_rel_in_head()
    {
            global $post;
            if ( !is_singular()) //if it is not a post or a page
            return;
    
            if(!has_post_thumbnail( $post->ID ))
            {
                    //the post does not have featured image, use a default image
                    $default_image="https://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library
                    echo '<meta property="og:image" content="' . $default_image . '"/>';
            }
            else
            {
                    $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
                    echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
            }
            echo "";
    }
    add_action( 'wp_head', 'insert_image_src_rel_in_head', 5 );
Viewing 1 replies (of 1 total)
  • The topic ‘facebook-error: "og:image too small" even if its not’ is closed to new replies.