123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- /*************************************************
- // ######### cleanup migration ################ //
- **************************************************/
- define('TRIBE_DISABLE_TOOLBAR_ITEMS', true);
- function srh_admin_bar_render() {
- global $wp_admin_bar;
- $wp_admin_bar->remove_menu('comments');
- $wp_admin_bar->remove_menu('customize');
- $wp_admin_bar->remove_menu('new-content');
- $wp_admin_bar->remove_menu('wp-logo');
- }
- add_action( 'wp_before_admin_bar_render', 'srh_admin_bar_render' );
- function hp_remove_admin_menus() {
- remove_menu_page( 'edit-comments.php' );
- }
- add_action( 'admin_menu', 'hp_remove_admin_menus' );
- function remove_comment_support() {
- remove_post_type_support( 'post', 'comments' );
- remove_post_type_support( 'page', 'comments' );
- }
- add_action('init', 'remove_comment_support', 100);
- function filter_media_comment_status( $open, $post_id ) {
- $post = get_post( $post_id );
- if( $post->post_type == 'attachment' ) {
- return false;
- }
- return $open;
- }
- add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 );
- function remove_default_img_sizes( $sizes ) {
- $targets = ['medium_large', 'large', '1536x1536', '2048x2048'];
- foreach($sizes as $size_index=>$size) {
- if(in_array($size, $targets)) {
- unset($sizes[$size_index]);
- }
- }
- return $sizes;
- }
- add_filter( 'intermediate_image_sizes', 'remove_default_img_sizes', 10, 1);
- /*************************************************
- // ############### wp_head ################## //
- **************************************************/
- remove_action('wp_head', 'index_rel_link' );
- remove_action('wp_head', 'rel_canonical');
- remove_action('wp_head', 'start_post_rel_link', 10);
- remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);
- remove_action('wp_head', 'wp_shortlink_wp_head', 10);
- remove_action('wp_head', 'parent_post_rel_link', 10);
- remove_action('wp_head', 'rsd_link');
- remove_action('wp_head', 'wlwmanifest_link');
- remove_action('wp_head', 'wp_generator');
- remove_action('wp_head', 'feed_links_extra', 3 );
- remove_action('wp_head', 'feed_links', 2 );
- remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);
- remove_action('wp_head', 'wp_oembed_add_host_js', 10);
- remove_action('wp_head', 'rest_output_link_wp_head', 10);
- remove_action('template_redirect', 'rest_output_link_header', 11, 0);
- function gw_remove_wp_ver_css_js( $src ) {
- if ( strpos( $src, 'ver=' ) )
- $src = remove_query_arg( 'ver', $src );
- return $src;
- }
- add_filter( 'style_loader_src', 'gw_remove_wp_ver_css_js', 9999 );
- add_filter( 'script_loader_src', 'gw_remove_wp_ver_css_js', 9999 );
- add_filter( 'xmlrpc_enabled', '__return_false' );
- add_filter( 'wp_headers', 'gw_disable_x_pingback' );
- function gw_disable_x_pingback( $headers ) {
- unset( $headers['X-Pingback'] );
- return $headers;
- }
- /*************************************************
- // ############### Emojis ################## //
- **************************************************/
- function gw_disable_emojis() {
- 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' );
- remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
- remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
- remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
- //add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
- add_filter( 'emoji_svg_url', '__return_false' );
- }
- add_action( 'init', 'gw_disable_emojis' );
|