[WordPress] Changing 'WP-OGP' Thumbnail Image og:image

Tadashi Shigeoka ·  Sun, March 2, 2014

I changed the thumbnail image from default for the “WP-OGP” plugin that sets up Facebook OGP in WordPress.

WordPress | ワードプレス

First, I tried overwriting wp-content/plugins/wp-ogp/default.jpg to change the thumbnail image, as this was supposed to work.

I was able to clear the cache properly with Facebook Debugger Tool, but when actually sharing on Facebook, it remained the default image.

Eventually, I handled it by changing the filename as follows.

Steps to Change WP-OGP Thumbnail Image

  1. Place the new thumbnail image file codenote-net-200x200.jpg under wp-content/plugins/wp-ogp/
  2. Change the image path returned by the wpogp_image_url_default method in wp-content/plugins/wp-ogp/wp-ogp.php as follows:
    function wpogp_image_url_default() {
            // default image associated is in the plugin directory named "default.png"
            //return wpogp_plugin_path() . '/default.jpg';
            return wpogp_plugin_path() . '/codenote-net-200x200.jpg';
    }
    
  3. Delete cache with Facebook Debugger Tool

That’s all from the Gemba.