<?php

/**
 * Removes WordPress default <head> information and extras
 *
 * WordPress adds lots of unnecessary stuff
 * into the header and footer of the HTML
 * This code removes most of it, although
 * future updates of WordPress may undo
 * these changes. In addition, the order
 * of these can make a difference to what
 * is removed, so don't mess with the order.
 * That's an order. ;)
 *
 * @since 1.0.0 
 *
 */

// REMOVE EMOJI
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
add_filter( 'emoji_svg_url', '__return_false' );
// REMOVE WEBLOG CLIENTS
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
// REMOVE URL SHORTLINKS
remove_action( 'wp_head', 'wp_shortlink_wp_head' );
// REMOVE WORDPRESS VERSION
remove_action('wp_head', 'wp_generator' );
// 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 rel links
remove_action( 'wp_head', 'feed_links' );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'parent_post_rel_link' );
remove_action( 'wp_head', 'start_post_rel_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link' );

// REMOVE wp-embed.min.js
function deregister_wp_embed() {
	
	wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_footer', 'deregister_wp_embed' );



/**
 * Removes YOAST Plugin stylesheet
 *
 * This function removes the YOAST
 * Plugin admin bar CSS stylesheet.
 *
 * @function deregister_yoast()
 *
 * @uses wp_deregister_style()
 *
 * @param N/A
 *
 * @return N/A
 *
 * @since 1.0.0 
 *
 */
function deregister_yoast() {
	
	wp_deregister_style( 'yoast-seo-adminbar' );
}	
add_action( 'wp_enqueue_scripts', 'deregister_yoast' );
