How To Get Email Alerts For 404 Pages In Website
Using the following snippet, you will be able to get email alerts for 404 pages in website.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
<?php // WP 404 ALERTS @ http://wp-mix.com/wordpress-404-email-alerts/ // set status header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); // site info $blog = get_bloginfo('name'); $site = get_bloginfo('url') . '/'; $email = get_bloginfo('admin_email'); // theme info if (!empty($_COOKIE["nkthemeswitch" . COOKIEHASH])) { $theme = clean($_COOKIE["nkthemeswitch" . COOKIEHASH]); } else { $theme_data = wp_get_theme(); $theme = clean($theme_data->Name); } // referrer if (isset($_SERVER['HTTP_REFERER'])) { $referer = clean($_SERVER['HTTP_REFERER']); } else { $referer = "undefined"; } // request URI if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER["HTTP_HOST"])) { $request = clean('http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); } else { $request = "undefined"; } // query string if (isset($_SERVER['QUERY_STRING'])) { $string = clean($_SERVER['QUERY_STRING']); } else { $string = "undefined"; } // IP address if (isset($_SERVER['REMOTE_ADDR'])) { $address = clean($_SERVER['REMOTE_ADDR']); } else { $address = "undefined"; } // user agent if (isset($_SERVER['HTTP_USER_AGENT'])) { $agent = clean($_SERVER['HTTP_USER_AGENT']); } else { $agent = "undefined"; } // identity if (isset($_SERVER['REMOTE_IDENT'])) { $remote = clean($_SERVER['REMOTE_IDENT']); } else { $remote = "undefined"; } // log time $time = clean(date("F jS Y, h:ia", time())); // sanitize function clean($string) { $string = rtrim($string); $string = ltrim($string); $string = htmlentities($string, ENT_QUOTES); $string = str_replace("\n", "<br>", $string); if (get_magic_quotes_gpc()) { $string = stripslashes($string); } return $string; } $message = "TIME: " . $time . "\n" . "*404: " . $request . "\n" . "SITE: " . $site . "\n" . "THEME: " . $theme . "\n" . "REFERRER: " . $referer . "\n" . "QUERY STRING: " . $string . "\n" . "REMOTE ADDRESS: " . $address . "\n" . "REMOTE IDENTITY: " . $remote . "\n" . "USER AGENT: " . $agent . "\n\n\n"; mail($email, "404 Alert: " . $blog . " [" . $theme . "]", $message, "From: $email"); ?> |
Snippet Source/Credit: WP Mix
How To Have Custom Favicon For Your WP-Admin
Using the following snippet, you will be able to have custom favicon for your WP-admin.
1 2 3 4 |
function admin_favicon() { echo '<link rel="shortcut icon" type="image/x-icon" href="' . get_bloginfo('template_directory') . '/images/favicon.ico" />'; } add_action( 'admin_head', 'admin_favicon' ); |
Snippet Source/Credit: Snipplr
How To show All Active Plugins In Your WordPress Website
Using the following snippet, you will be able to know about all the active plugins in your WordPress website.
1 2 3 4 5 6 7 8 |
function wpse_54742_active_site_plugins() { $the_plugs = get_option('active_plugins'); foreach($the_plugs as $key => $value) { $string = explode('/',$value); // Folder name will be displayed echo $string[0] ."\n"; } } wpse_54742_active_site_plugins(); |
Snippet Source/Credit: Snipplr
How To Rename WordPress Folder
Using the following snippet you will be able to rename WordPress folder.
1 2 3 4 |
define ( 'WP_CONTENT_FOLDERNAME', 'public' ); define ( 'WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME ); define ( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/' ); define ( 'WP_CONTENT_URL', WP_SITEURL . WP_CONTENT_FOLDERNAME ); |
Snippet Source/Credit: Snipplr
How To Disable Plugins Update In Your WordPress Blog
Using the following snippet, you will be able to disable plugins update in your WordPress blog.
1 2 |
remove_action( 'load-update-core.php', 'wp_update_plugins' ); add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) ); |
Snippet Source/Credit: WP Snippets