Guest User

Untitled

a guest
Sep 9th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1.  
  2. /** CUSTOM OPTIM CODE : by Christopher Simmons - REV 8.17.16 */
  3.  
  4. // Remove jQuery Migrate Script from header and Load jQuery from Google API
  5. function simmonsbunny_remove_jquery_migrate_load_google_hosted_jquery() {
  6. if (!is_admin()) {
  7. wp_deregister_script('jquery');
  8. wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, null);
  9. wp_enqueue_script('jquery');
  10. }
  11. }
  12. add_action('init', 'simmonsbunny_remove_jquery_migrate_load_google_hosted_jquery');
  13. /** functions for headcleaner */
  14. function rm_generator_filter() { return ''; }
  15. add_filter('the_generator', 'rm_generator_filter');
  16.  
  17. remove_action('wp_head','wlwmanifest_link');
  18. remove_action('wp_head','rsd_link');
  19. remove_action('wp_head','feed_links', 2);
  20. remove_action('wp_head','feed_links_extra', 3);
  21. remove_action('wp_head','start_post_rel_link', 10, 0);
  22. remove_action('wp_head','adjacent_posts_rel_link_wp_head', 10, 0);
  23. remove_action('wp_head','print_emoji_detection_script',7);
  24. remove_action('wp_print_styles','print_emoji_styles');
  25.  
  26. function remove_cssjs_ver( $src ) {
  27. if( strpos( $src, '?ver=' ) )
  28. $src = remove_query_arg( 'ver', $src );
  29. return $src;
  30. }
  31. add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
  32. add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
  33.  
  34. function remove_pingback_url( $output, $show ) {
  35. if ( $show == 'pingback_url' ) $output = '';
  36. return $output;
  37. }
  38. add_filter( 'bloginfo_url', 'remove_pingback_url', 10, 2 );
  39.  
  40. /** functions for security */
  41. function no_errors_please(){
  42. return 'You appear to be up to no good. Your IP logged and will be blocked.';
  43. }
  44. add_filter( 'login_errors', 'no_errors_please' );
  45.  
  46. function disable_reset_lost_password()
  47. {
  48. return false;
  49. }
  50. add_filter( 'allow_password_reset', 'disable_reset_lost_password');
  51.  
  52. function remove_lost_your_password($text)
  53. {
  54. return str_replace( array('Lost your password?', 'Lost your password'), '', trim($text, '?') );
  55. }
  56. add_filter( 'gettext', 'remove_lost_your_password' );
  57.  
  58. add_filter( 'send_email_change_email', '__return_false' );
  59.  
  60. /** functions for admin bar */
  61. function mytheme_admin_bar_render() {
  62. global $wp_admin_bar;
  63. $wp_admin_bar->remove_menu('wpseo-menu');
  64. }
  65. add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
  66. add_filter( 'wpseo_use_page_analysis', '__return_false' );
  67.  
  68. function my_custom_css() {
  69. echo '<style>
  70. .misc-pub-section.yoast-seo-score.content-score { display: none; }
  71. .misc-pub-section.yoast-seo-score.keyword-score { display: none; }
  72. </style>';
  73. }
  74. add_action( 'admin_head', 'my_custom_css' );
  75.  
  76. function dequeue_yoast_css() {
  77. wp_dequeue_style('yoast-seo-adminbar');
  78. wp_deregister_style('yoast-seo-adminbar');
  79. }
  80. add_action('wp_enqueue_scripts','dequeue_yoast_css');
  81.  
  82. /*remove embeds */
  83. function disable_embeds_init() {
  84. remove_action('rest_api_init', 'wp_oembed_register_route');
  85. remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
  86. remove_action('wp_head', 'wp_oembed_add_discovery_links');
  87. remove_action('wp_head', 'wp_oembed_add_host_js');
  88. }
  89. add_action('init', 'disable_embeds_init', 9999);
  90.  
  91. function project_dequeue_unnecessary_scripts() {
  92. wp_dequeue_script( 'comment-reply' );
  93. wp_deregister_script( 'comment-reply' );
  94. }
  95. add_action( 'wp_print_scripts', 'project_dequeue_unnecessary_scripts',100 );
  96.  
  97. // Remove comment-reply.min.js from footer
  98. function chrisbunny_clean_header_hook(){
  99. wp_deregister_script( 'comment-reply' );
  100. }
  101. add_action('init','chrisbunny_clean_header_hook');
  102.  
  103. /** End Christopher's magic bunny code; Copr. (c) 2013-2016 CLS */
Add Comment
Please, Sign In to add comment