Created
July 16, 2016 22:37
-
-
Save ncserny/0e548d3933317bffb1c7b0aa90c69311 to your computer and use it in GitHub Desktop.
WordPress Instant Articles Remove Extra Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// remove extra tags above the feed which comes from other plugins. | |
add_action('wp_footer', 'remove_extra_code_above_feed', 9); // 9 because by default above plugin functions executes at 10 priority. | |
function remove_extra_code_above_feed() | |
{ | |
if (is_feed()) { | |
// removing these methods because they are generating extra content before the Facebook IA feed. | |
remove_filter('wp_footer', 'gdlr_additional_script'); | |
remove_filter('wp_footer', 'an_prepare'); | |
remove_filter('wp_footer', 'cookielawinfo_inject_cli_script'); | |
remove_anonymous_object_filter( | |
'wp_print_footer_scripts', | |
'TablePress_Frontend_Controller', | |
'add_datatables_calls' | |
); | |
remove_anonymous_object_filter( | |
'wp_footer', | |
'PolldaddyShortcode', | |
'generate_scripts' | |
); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
//print_r($GLOBALS['wp_filter'][ 'wp_footer' ]); // Uncomment this line to see which function are insert any extra data to feed. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment