Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/jeherve/jeherve-custom-ogurls/archive/refs/heads/master.zipCustom Open Graph URLs WordPress plugin
Define custom OG URLs for each one of your posts. If you don't add a custom OG URL, the default one (post permalink) will be used.
There are a few required conditions for this to work
- Jetpack must be active on your site.
- Jetpack's Sharing module or Jetpack's Publicize module have to be active.
- No other Open Graph plugin must be installed on your site.
How to use the plugin
The plugin won't add any new input field or interface on your site. Once it's active, you can specify a custom Opeg Graph URL for each post by going to Posts > All Posts in your dashboard, clicking on the post you want to edit, and using the Custom Fields input field to add a new custom field with the name custom_og_url and the value you need, like so:

If you do not see a Custom Fields interface in your post editor, make sure it is enabled in your Screen Options at the top of the screen:

Why would I want to do that?
This plugin is especially useful when switching from HTTP to HTTPS on your site, and if you want to keep the number of Facebook shares you had collected for some of your posts when your site was still using HTTP.
In an ideal world, Facebook would detect that the HTTP URL now redirects to HTTPs, and move the sharing counts over as well. Unfortunately, that does not always happen. Facebook recommends the following to keep the sharing counts. This plugin will allow you to do that for the posts that matter to you, while letting Facebook collect sharing counts for the new, HTTPS URL, for all the other posts where you do not specify a custom_og_url custom field.
For the posts where you want to keep the sharing counts from before the switch:
- Install and activate this plugin.
- Go to Posts > All Posts
- Find the post you want to edit.
- Open the editor.
- Follow the instructions above to locate the Custom Fields interface.
- Create a new custom field with the name
custom_og_url. The value should be the post URL, but withhttp://instead ofhttps://.
More info.
Find out more about this plugin here: