This repository has been archived by the owner on Dec 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
cleanup.php
executable file
·79 lines (72 loc) · 2.55 KB
/
cleanup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* Clean up WordPress defaults
*/
if ( ! function_exists( 'base_start_cleanup' ) ) :
function base_start_cleanup() {
// Launching operation cleanup.
add_action( 'init', 'base_cleanup_head' );
// Remove WP version from RSS.
add_filter( 'the_generator', 'base_remove_rss_version' );
// Remove pesky injected css for recent comments widget.
add_filter( 'wp_head', 'base_remove_wp_widget_recent_comments_style', 1 );
// Clean up comment styles in the head.
add_action( 'wp_head', 'base_remove_recent_comments_style', 1 );
// Change JPEG Compression
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) );
}
add_action( 'after_setup_theme','base_start_cleanup' );
endif;
/**
* Clean up head
*/
if ( ! function_exists( 'base_cleanup_head' ) ) :
function base_cleanup_head() {
// EditURI link.
remove_action( 'wp_head', 'rsd_link' );
// Category feed links.
remove_action( 'wp_head', 'feed_links_extra', 3 );
// Post and comment feed links.
remove_action( 'wp_head', 'feed_links', 2 );
// Windows Live Writer.
remove_action( 'wp_head', 'wlwmanifest_link' );
// Index link.
remove_action( 'wp_head', 'index_rel_link' );
// Previous link.
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
// Start link.
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
// Shortlink.
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
// Links for adjacent posts.
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
// WP version.
remove_action( 'wp_head', 'wp_generator' );
// Emoji detection script.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
// Emoji styles.
remove_action( 'wp_print_styles', 'print_emoji_styles' );
}
endif;
// Remove WP version from RSS.
if ( ! function_exists( 'base_remove_rss_version' ) ) :
function base_remove_rss_version() { return ''; }
endif;
// Remove injected CSS for recent comments widget.
if ( ! function_exists( 'base_remove_wp_widget_recent_comments_style' ) ) :
function base_remove_wp_widget_recent_comments_style() {
if ( has_filter( 'wp_head', 'wp_widget_recent_comments_style' ) ) {
remove_filter( 'wp_head', 'wp_widget_recent_comments_style' );
}
}
endif;
// Remove injected CSS from recent comments widget.
if ( ! function_exists( 'base_remove_recent_comments_style' ) ) :
function base_remove_recent_comments_style() {
global $wp_widget_factory;
if ( isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments']) ) {
remove_action( 'wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style') );
}
}
endif;
?>