Halloween Sale 15% off Ends in See the plans
PHP

Default Social Image for Jetpack Open Graph Tags

Sets the image Jetpack uses in Open Graph tags when a post has no featured image or images in its content, so shared links always show your brand instead of a blank square.

Don’t have WPIDE yet? Install it on your site

Code

$wpide_image = 'https://example.com/wp-content/uploads/social-default.jpg'; // Fallback image URL.

add_filter( 'jetpack_open_graph_image_default', function () use ( $wpide_image ) {
    return esc_url_raw( $wpide_image );
} );

Notes

Use a full image URL; 1200×630 pixels works best on most networks.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.