Use Social Warfare data for Pinterest images and descriptions

Shared Counts lets you specify a custom Pinterest image and description when using the Shared Counts – Pinterest Image addon.

If you’re switching from Social Warfare to Shared Counts, you can retain your custom Pinterest images and descriptions you entered by telling Shared Counts to use a different meta key for storing/retrieving its data.

We can set the meta keys to match Social Warfare, which will ensure all your existing Pinterest images and descriptions continue working with Shared Counts.

This code snippet goes in a core functionality plugin or Code Snippets.

/**
 * Copy Pinterest data from Social Warfare
 * @see https://sharedcountsplugin.com/2020/08/26/use-social-warfare-data-for-pinterest-images-and-descriptions/
 */
function be_pinterest_meta_key( $key, $type ) {
	if( 'image' === $type ) {
		$key = 'swp_pinterest_image_url';
	} elseif( 'desc' === $type ) {
		$key = 'swp_pinterest_description';
	}
	return $key;
}
add_filter( 'shared_counts_pinterest_image_meta_key', 'be_pinterest_meta_key', 10, 2 );Code language: PHP (php)

Filters used:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.