Thrive Knowledge Base

Filter Open Graph Social Meta Data

We recently had an issue where a customer converted to https but wanted to retain non https open graph social meta data.  Here is a link to the thread.

​To enable this, we've added a filter that allows you to modify the open graph meta data programatically.

The New Filter:-

We've added this filter to our codebase on all themes:-

$meta = apply_filters('tha_social_meta', $meta);

$meta is an array of meta data as constructed as follows:-

$meta = array(
//uniqueID => meta
'og:type' => array(
//attribute -> value
'property' => 'og:type',
'content' => $page_type,
'og:url' => array(
'property' => 'og:url',
'content' => $current_url,
'twitter:card' => array(
'name' => 'twitter:card',
'content' => 'summary_large_image'

Example of How to Filter the Open Graph Meta Data:-

If you're running a child theme you can add the following code in functions.php.  Alternatively, if you're not running a child theme, then I recommend you create this as a separate plugin so your changes aren't overwritten on theme update.

​Sample Code for this Filter

This example overrides the og:url meta:-

​add_filter("tha_social_meta", "modify_og_url");

function modify_og_url($meta) {
$url = 'your custom url';
$meta['og:url']['content'] = $url;

return $meta;

This filter will allow you to do things like:-

  • ​Modify the social meta protocol to retain previously built social meta signals
  • Make any other changes that you require to the social meta data parameters