• Resolved -javier-

    (@javier-2)


    Hi,
    The filter jetpack_open_graph_image_default doesn’t work anymore.

    This is the code on my site:

    function jeherve_default_image() {
        $fallback_img = 'https://hemofiliaenchile.cl/imgs/logotipo.png';
        return esc_url( $fallback_img );
    }
    add_filter( 'jetpack_open_graph_image_default', 'jeherve_default_image' );

    It was working fine a month ago, but now completely ignore it.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter -javier-

    (@javier-2)

    Workaround, delete this on function.opengraph.php

    if ( empty( $image ) && ( function_exists( 'has_site_icon') && has_site_icon() ) ) {
    		$img_width  = '';
    		$img_height = '';
    
    		$max_side = max( $width, $height );
    		$image_url = get_site_icon_url( $max_side );
    		$image_id = get_option( 'site_icon' );
    		$image_size = wp_get_attachment_image_src( $image_id, $max_side >= 512
    			? 'full'
    			: array( $max_side, $max_side ) );
    		if ( isset( $image_size[1], $image_size[2] ) ) {
    			$img_width  = $image_size[1];
    			$img_height = $image_size[2];
    		}
    
    		if (_jetpack_og_get_image_validate_size($img_width, $img_height, $width, $height)) {
    			$image['src']     = $image_url;
    			$image['width']   = $width;
    			$image['height']  = $height;
    		}
    	}

    and this on class.jetpack-twitter-cards.php

    if ( empty( $og_tags['twitter:image'] ) && ( function_exists( 'has_site_icon' ) && has_site_icon() ) ) {
    				$og_tags['twitter:image'] = get_site_icon_url( '240' );
    			}

    Hi @-javier-

    I just saw this new thread of yours after replying to your previous. Thanks for reporting this – this is strange as we haven’t made any changes to that file since March.

    I’ll have to try this this a bit and see if I can replicate the issue and escalate as needed.

    We definitely wouldn’t recommend editing plugin files directly as well as the changes can be reverted when the plugin is updated.

    Cheers.

    Thread Starter -javier-

    (@javier-2)

    Hi @lamday

    I know, but it’s the only solution working so far, just a temporary fix.

    I Hope a solution will be found.

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘jetpack_open_graph_image_default doesn’t work anymore’ is closed to new replies.