Skip to content

Instantly share code, notes, and snippets.

@kristarella
Last active March 14, 2018 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kristarella/e0efbac9011708f3c9ee34106b6f202a to your computer and use it in GitHub Desktop.
Save kristarella/e0efbac9011708f3c9ee34106b6f202a to your computer and use it in GitHub Desktop.
<?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