Advertisement
Guest User

Untitled

a guest
May 27th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. /**
  2. * Suppress errors generated by specified WordPress plugins.
  3. *
  4. * Put this in /wp-content/mu-plugins/
  5. *
  6. * @param string $errno The error number.
  7. * @param string $errstr The error message.
  8. * @param string $errfile Path to the file that caused the error.
  9. * @param int $errline Line number of the error.
  10. * @return bool True to suppress error reporting; false to use default error handler.
  11. */
  12. function my_error_handler( $errno, $errstr, $errfile, $errline ) {
  13. if ( E_STRICT == $errno ) {
  14. // Return true to disable all strict notices.
  15. //return true;
  16. }
  17.  
  18. // bbPress creates this when the current user is set up too early
  19. if ( false !== strpos( $errstr, 'bbp_setup_current_user was called' ) ) {
  20. return true;
  21. }
  22.  
  23. // BuddyPress creates this when the current user is set up too early
  24. if ( false !== strpos( $errstr, 'bp_setup_current_user was called' ) ) {
  25. return true;
  26. }
  27.  
  28. // Older BuddyPress group extensions
  29. if ( false !== strpos( $errstr, 'Group_Extension::display' ) ) {
  30. return true;
  31. }
  32.  
  33. // CBOX Theme
  34. $patterns = array(
  35. 'themes/cbox-theme',
  36. );
  37.  
  38. foreach ( $patterns as $pattern ) {
  39. $pattern = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $pattern );
  40.  
  41. if ( false !== strpos( $errstr, $pattern ) ) {
  42. return true;
  43. }
  44.  
  45. if ( false !== strpos( $errfile, $pattern ) ) {
  46. return true;
  47. }
  48. }
  49.  
  50. // The path was not found, so report the error.
  51. return false;
  52. }
  53. set_error_handler( 'my_error_handler' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement