Support » Plugin: Yoast SEO » Fallback size in wpseo_opengraph_image_size

  • Resolved sgrx

    (@sgrx)


    I’m using this filter to have Yoast choose a custom sized image for FB using this code:

    function filter_wpseo_opengraph_image_size( $original ) {
        return "custom-size";
    };
    add_filter( 'wpseo_opengraph_image_size', 'filter_wpseo_opengraph_image_size', 10, 1 );

    It works fine when the image selected by the user in the Facebook image area in the Yoast box of the Page has an image with the size “custom-size”. If the image does not have this size, then no og:image tag is outputted. How can I create a fallback size or let yoast show the default size if the image selected by the user doesn’t have a resolution of “custom-size”?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support amboutwe

    (@amboutwe)

    When this filter is used, the defined size will always be used for the og:image and no fallback will be used.

    You or your developer could add an if/else statement that checks if the image has a custom size before returning the custom size.

    Plugin Support Jerlyn

    (@jerparx)

    Closed. No further questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fallback size in wpseo_opengraph_image_size’ is closed to new replies.