Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function removeExtraHeadTags()
- {
- add_action( 'wp_enqueue_scripts', function () { wp_dequeue_style( 'wc-block-style' ); wp_dequeue_style( 'storefront-gutenberg-blocks' ); } );
- // remove s.w.org dns prefetch tag
- add_filter( 'wp_resource_hints', function ( $hints, $relation_type ) { return ('dns-prefetch' === $relation_type && array_pop($hints ) ) ? $hints : $hints; } , 10, 2 );
- // remove feeds, etc
- remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
- remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
- remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
- remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
- remove_action( 'wp_head', 'index_rel_link' ); // index link
- add_filter('after_setup_theme', function () { remove_action('wp_head', 'wp_shortlink_wp_head', 10); if(0) remove_action( 'template_redirect', 'wp_shortlink_header', 11); });
- remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
- remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
- remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post.
- remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version
- // emojis
- remove_action('wp_head', 'print_emoji_detection_script', 7);
- remove_action('wp_print_styles', 'print_emoji_styles');
- remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
- remove_action( 'admin_print_styles', 'print_emoji_styles' );
- //
- remove_action( 'wp_head', 'rest_output_link_wp_head' );
- remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
- remove_action( 'template_redirect', 'rest_output_link_header', 11 );
- add_filter( 'xmlrpc_enabled', '__return_false' );
- add_filter( 'xmlrpc_methods', function () { return []; }, 99999 );
- $remove_json_api = function () {
- // Remove the REST API lines from the HTML Header
- remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
- remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
- // Remove the REST API endpoint.
- remove_action( 'rest_api_init', 'wp_oembed_register_route' );
- // Turn off oEmbed auto discovery.
- add_filter( 'embed_oembed_discover', '__return_false' );
- // Don't filter oEmbed results.
- remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
- // Remove oEmbed discovery links.
- remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
- // Remove oEmbed-specific JavaScript from the front-end and back-end.
- remove_action( 'wp_head', 'wp_oembed_add_host_js' );
- // Remove all embeds rewrite rules.
- //add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
- };
- add_action( 'after_setup_theme', $remove_json_api );
- }
Add Comment
Please, Sign In to add comment