Skip to content

Instantly share code, notes, and snippets.

@codeHusky
Created July 20, 2020 04:22
Show Gist options
  • Save codeHusky/b3864ec14485e237b50b6dc799411827 to your computer and use it in GitHub Desktop.
Save codeHusky/b3864ec14485e237b50b6dc799411827 to your computer and use it in GitHub Desktop.
WP Plugin that removes useless author info from WordPress Page embed data.
<?php
/**
* Plugin Name: oEmbed Patcher
* Description: Removes useless metadata from WordPress oEmbeds
* Version: 1.0.0
* Author: Loki Rautio AKA codeHusky
*/
// Be sure to enclose this in a folder of the same name as the file (minus .php).
// e.g. /wp-content/plugins/oembed-patcher/oembed-patcher.php
function oep_oembed_response_data( $data, $post, $width, $height){
if ( $post->post_type == "page" ){
unset($data['author_name']);
unset($data['author_url']);
}
return $data;
}
add_filter('oembed_response_data', 'oep_oembed_response_data', 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment