Created
March 23, 2019 13:13
-
-
Save mertcangokgoz/828dfcb279f28288457b5f7061103f48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Custom Wordpress Functions | |
/*------------------------------*/ | |
function _remove_script_version( $src ){ | |
$parts = explode( '?ver', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); | |
function wptao_disable_version_info() { return ''; } | |
add_filter('the_generator', 'wptao_disable_version_info'); | |
add_filter('login_errors',create_function('$a',"return null;")); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wp_generator'); | |
/*E-mail Remove*/ | |
function security_remove_emails($content) { | |
$pattern = '/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})/i'; | |
$fix = preg_replace_callback($pattern,"security_remove_emails_logic", $content); | |
return $fix; | |
} | |
function security_remove_emails_logic($result) { | |
return antispambot($result[1]); | |
} | |
add_filter( 'the_content', 'security_remove_emails', 20 ); | |
add_filter( 'widget_text', 'security_remove_emails', 20 ); | |
/* Admin Bar özelliğini iptal et */ | |
add_filter( 'show_admin_bar', '__return_false' ); | |
/* Admin Bar seçeneklerini kullanıcı profilinden kaldır */ | |
remove_action( 'personal_options', '_admin_bar_preferences' ); | |
/*Css and JS Versiyon Remove*/ | |
function vc_remove_wp_ver_css_js( $src ) { | |
if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) ) | |
$src = remove_query_arg( 'ver', $src ); | |
return $src; | |
} | |
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 ); | |
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 ); | |
/*Hide admin notifications for non admins*/ | |
function hide_update_notice_to_all_but_admin_users() | |
{ | |
if (!current_user_can('update_core')) { | |
remove_action( 'admin_notices', 'update_nag', 3 ); | |
} | |
} | |
add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 ); | |
/*Costum Avatar*/ | |
add_filter( 'avatar_defaults', 'newgravatar' ); | |
function newgravatar ($avatar_defaults) | |
{ | |
$myavatar = "avatarlink"; | |
$avatar_defaults[$myavatar] = "avatarNick"; | |
return $avatar_defaults; | |
} | |
function disable_wp_emojicons() { | |
// all actions related to emojis | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
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_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); | |
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); | |
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); | |
// filter to remove TinyMCE emojis | |
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' ); | |
} | |
add_action( 'init', 'disable_wp_emojicons' ); | |
function disable_emojicons_tinymce( $plugins ) { | |
if ( is_array( $plugins ) ) { | |
return array_diff( $plugins, array( 'wpemoji' ) ); | |
} else { | |
return array(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment