Pure code of WordPress solve slow loading solution

wordpress powerful, and strong expansion, thanks to its numerous plug-in, easy to expand functionality, basically a complete website some features, all functions can be achieved through its third-party plug-ins. WordPress has a strong community support, there are tens of millions of developers contribute and review WordPress, WordPress is so safe and active. Because static poor, or rather the real static doing a good job, so when accessing the background of WordPress will load a lot of interface information. When you log in WordPress background, it will connect interface to the official WordPress, get updates, theme updates, plug-in updates, language packs and other updates, due to the WordPress official servers in foreign countries, so that domestic users access to load extremely slow, sometimes directly suspended animation . We need to do is block out unwanted background check function, add the following code to the file functions.php function under your current theme directory:

  1. // function to remove unnecessary background  
  2. function disable_dashboard_widgets() {   
  3. remove_meta_box ( 'dashboard_recent_comments' , 'Dashboard' , 'Normal' ) ; // Recent Comments
  4. remove_meta_box ( 'dashboard_recent_drafts' , 'Dashboard' , 'Normal' ) ; // recent drafts
  5. remove_meta_box('dashboard_primary', 'dashboard', 'core');//wordpress博客 
  6. remove_meta_box ( 'dashboard_secondary' , 'Dashboard' , 'Core' ) ; // other news WordPress
  7. remove_meta_box('dashboard_right_now', 'dashboard', 'core');//wordpress概况 
  8. remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');//wordresss链入链接 
  9. remove_meta_box ( 'dashboard_plugins' , 'Dashboard' , 'Core' ) ; // WordPress links widget
  10. remove_meta_box ( 'dashboard_quick_press' , 'Dashboard' , 'Core' ) ; // WordPress Rapid Release
  11. }   
  12. add_action('admin_menu', 'disable_dashboard_widgets'); 
  13. // Remove WordPress version number to load the JS and CSS links  
  14. function wpdaxue_remove_cssjs_ver( $src ) {  
  15. if( strpos( $src, 'ver=' ) ) 
  16. $src = remove_query_arg( 'ver', $src ); 
  17. return $src;  
  18. }  
  19. add_filter( 'style_loader_src', 'wpdaxue_remove_cssjs_ver', 999 ); 
  20. add_filter( 'script_loader_src', 'wpdaxue_remove_cssjs_ver', 999 ); 
  21. // removed automatically saved  
  22. wp_deregister_script('autosave');  
  23. // Remove revision  
  24. remove_action('post_updated','wp_save_post_revision' ); 
  25. // disable Google Open Sans font background, speed up website  
  26. add_filter( 'gettext_with_context', 'wpdx_disable_open_sans', 888, 4 ); 
  27. function wpdx_disable_open_sans( $translations, $text, $context, $domain ) { 
  28. if ( 'Open Sans font: on or off' == $context && 'on' == $text ) { 
  29. $translations = 'off';  
  30. }return $translations;  
  31. }

Guess you like

Origin www.cnblogs.com/guihaoming/p/11941483.html