| Server IP : 219.234.31.115 / Your IP : 216.73.217.134 Web Server : Apache System : Linux ebs-140924 5.10.0-30-amd64 #1 SMP Debian 5.10.218-1 (2024-06-01) x86_64 User : vndaystarftp ( 67432) PHP Version : 7.3.33 Disable Function : link,symlink,passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server,pcntl_fork,pcntl_rfork MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/wwwroot/vndaystarftp/wwwroot/wp-content/themes/phlox-pro/ |
Upload File : |
<?php
/**
* Functions and definitions for auxin framework
*
*
* @package Auxin
* @author averta (c) 2014-2021
* @link http://averta.net
*/
/*-----------------------------------------------------------------------------------*/
/* Add your custom functions here - We recommend you to use "code-snippets" plugin instead
/* https://wordpress.org/plugins/code-snippets/
/*-----------------------------------------------------------------------------------*/
// your code here
//屏蔽后台更新模块
function wp_hide_nag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
add_action('admin_menu','wp_hide_nag');
// 彻底关闭自动更新
add_filter('automatic_updater_disabled', '__return_true');
// 关闭更新检查定时作业
remove_action('init', 'wp_schedule_update_checks');
// 移除已有的版本检查定时作业
wp_clear_scheduled_hook('wp_version_check');
// 移除已有的插件更新定时作业
wp_clear_scheduled_hook('wp_update_plugins');
// 移除已有的主题更新定时作业
wp_clear_scheduled_hook('wp_update_themes');
// 移除已有的自动更新定时作业
wp_clear_scheduled_hook('wp_maybe_auto_update');
// 移除后台内核更新检查
remove_action( 'admin_init', '_maybe_update_core' );
// 移除后台插件更新检查
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
// 移除后台主题更新检查
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );
add_filter('pre_site_transient_update_core', function(){"null";}); // 关闭核心提示
add_filter('pre_site_transient_update_plugins', function(){"null";}); // 关闭插件提示
add_filter('pre_site_transient_update_themes', function(){"null";}); // 关闭主题提示
// 屏蔽 REST API
add_filter('rest_enabled', '__return_false');
add_filter('rest_jsonp_enabled', '__return_false');
// 移除头部 wp-json 标签和 HTTP header 中的 link
remove_action('template_redirect', 'rest_output_link_header', 11 );
//禁止加载s.w.org并移动dns-prefetch
function remove_dns_prefetch( $hints, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
return array_diff( wp_dependencies_unique_hosts(), $hints );
}
return $hints;
}
add_filter( 'wp_resource_hints', 'remove_dns_prefetch', 10, 2 );
// 首先移除多余的feed链接
remove_action( 'wp_head','feed_links', 2 );
remove_action( 'wp_head','feed_links_extra', 3 );
// 2、移除谷歌字体,同样是为了防止官方网址打开缓慢,直接移除:
if (!function_exists('remove_wp_open_sans')) {
function remove_wp_open_sans() {
wp_deregister_style('open-sans');
wp_register_style('open-sans', false);
}
}
add_filter('wp_enqueue_scripts', 'remove_wp_open_sans');
add_filter('admin_enqueue_scripts', 'remove_wp_open_sans');
// 4、禁用emoji,这个真的是作用不大,感觉多余,直接移除:
function 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_action( 'init', 'disable_emojis' );
//Filter function used to remove the tinymce emoji plugin.
function disable_emojis_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
// 5、禁用embeds,这个也没什么作用,虽然说只是移除wp-embed.min.js,但代码稍微有点多,直接应用没事:
function disable_embeds_init() {
global $wp; // Remove the embed query var.
$wp->public_query_vars = array_diff( $wp->public_query_vars, array('embed',)); // Remove the REST API endpoint.
remove_action( 'rest_api_init', 'wp_oembed_register_route' ); // Turn off
add_filter( 'embed_oembed_discover', '__return_false' );
remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
add_filter( 'tiny_mce_plugins', 'disable_embeds_tiny_mce_plugin' );
add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
}
add_action( 'init', 'disable_embeds_init', 9999 );
function disable_embeds_tiny_mce_plugin( $plugins ) {
return array_diff( $plugins, array( 'wpembed' ) );
}
function disable_embeds_rewrites( $rules ) {
foreach ( $rules as $rule => $rewrite ) {
if ( false !== strpos( $rewrite, 'embed=true' ) ) {
unset( $rules[ $rule ] );
}
}
return $rules;
}
function disable_embeds_remove_rewrite_rules() {
add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'disable_embeds_remove_rewrite_rules' );
function disable_embeds_flush_rewrite_rules() {
remove_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'disable_embeds_flush_rewrite_rules' );
//移除头部不必要的链接
remove_action( 'wp_head', 'wp_resource_hints', 2);// 去除DNS预解析
remove_action( 'wp_head', 'wp_generator' ); //隐藏wordpress版本
remove_action( 'wp_head', 'rsd_link' );//移除头部RSD链接
remove_action( 'wp_head', 'wlwmanifest_link' );//移除头部wlwmanifest链接
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );//移除头部wp-json链接
remove_action( 'wp_head', 'wp_shortlink_wp_head'); //移除头部shortlink
remove_action( 'wp_head', 'rel_canonical' );//移除canonical标记
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head');//移除头部上下篇链接
// add_filter( 'show_admin_bar', '__return_false' ); //删除AdminBar
add_filter('xmlrpc_enabled', '__return_false');//屏蔽 XML-RPC (pingback) 的功能
function remove_block_library_css() {
wp_dequeue_style( 'wp-block-library' );
}
add_action( 'wp_enqueue_scripts', 'remove_block_library_css', 100 );
add_filter( 'automatic_updater_disabled', '__return_true' );
function example_remove_dashboard_widgets() {
// Globalize the metaboxes array, this holds all the widgets for wp-admin
global $wp_meta_boxes;
// 以下这一行代码将删除 "快速发布" 模块
//unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
// 以下这一行代码将删除 "引入链接" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
// 以下这一行代码将删除 "插件" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
// 以下这一行代码将删除 "近期评论" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
// 以下这一行代码将删除 "近期草稿" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
// 以下这一行代码将删除 "WordPress 开发日志" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
// 以下这一行代码将删除 "其它 WordPress 新闻" 模块
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
// 以下这一行代码将删除 "概况" 模块
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health']);
unset($wp_meta_boxes['dashboard']['normal']['core']['e-dashboard-overview']);
}
add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
//修改后台logo
function custom_loginlogo() {
echo '<style type="text/css">
h1 a {
background-image: url('.get_bloginfo('template_directory').'/images/logo_01.png) !important;
display: inline-block !important;
width: 275px !important;
background-size: 275px !important;
margin:0px !important;
}
</style>';
}
add_action('login_head', 'custom_loginlogo');
/**移除后台顶部左上角图标*/
function annointed_admin_bar_remove() {
global $wp_admin_bar;/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
//删除WordPress后台底部版权信息
add_filter('admin_footer_text', '_admin_footer_left_text');
function _admin_footer_left_text($text) {
$text = '';
return $text;
}
//删除WordPress后台版本号信息
add_filter('update_footer', '_admin_footer_right_text', 11);
function _admin_footer_right_text($text) {
$text = '';
return $text;
}
//删除WordPress后台右上角帮助
add_action('in_admin_header', function(){
global $current_screen;
$current_screen->remove_help_tabs();
});
/*-----------------------------------------------------------------------------------*/
/* Init theme framework
/*-----------------------------------------------------------------------------------*/
require( 'auxin/auxin-include/auxin.php' );
/*-----------------------------------------------------------------------------------*/