Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/*
Plugin Name: Force HTTP sharing URL
Description: Make og:url HTTP in Yoast and Jetpack meta data
Version: 20181127
Author: kristarella
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
/* Enforce HTTP Open Graph URLs in Yoast SEO
* Credit: stodorovic https://github.com/stodorovic
* Last Tested: Feb 06 2017 using Yoast SEO 5.8 on WordPress 4.8.2
*/
add_filter( 'wpseo_opengraph_url', 'yoast_http_og_url' );
function yoast_http_og_url( $url ) {
return str_replace( 'https://', 'http://', $url );
}
/* Enforce HTTP Open Graph URLs in Jetpack
*
*/
add_filter( 'jetpack_open_graph_tags', 'jetpack_http_og_url' );
function jetpack_http_og_url( $tags ) {
$tags['og:url'] = str_replace( 'https://', 'http://', $tags['og:url'] );
return $tags;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.