Skip to content

Instantly share code, notes, and snippets.

Avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@chrisdavidmiles
chrisdavidmiles / .htaccess
Created Sep 4, 2022
Block Crawlers and Other Bots .htaccess
View .htaccess
# START Block Crawlers
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^APIs-Google [OR]
RewriteCond %{HTTP_USER_AGENT} ^AdsBot-Google [OR]
RewriteCond %{HTTP_USER_AGENT} ^AdsBot-Google-Mobile [OR]
RewriteCond %{HTTP_USER_AGENT} ^AdsBot-Google-Mobile-Apps [OR]
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
@chrisdavidmiles
chrisdavidmiles / cdm-remove-unwanted-image-sizes.php
Last active Aug 30, 2022 — forked from gmmedia/functions.php
WordPress Plugin: Remove Unwanted Image Sizes
View cdm-remove-unwanted-image-sizes.php
<?php
/**
* Plugin Name: Remove Unwanted Default Image Sizes
* Plugin URI: https://gist.github.com/chrisdavidmiles/6fd21201d16f8a7e434b06b903d4706c
* Description: This removes three default image sizes that I don't want: medium_large, 1536x1536, and 2048x2048.
* Author: Jochen Gererstorfer
* Author URI: https://bloggerpilot.com/en/disable-wordpress-image-sizes/
* Version: 0.3
*/
@chrisdavidmiles
chrisdavidmiles / cdm-disable-emojis.php
Created Aug 25, 2022
WordPress Plugin: Disable Emojis
View cdm-disable-emojis.php
<?php
/**
* Plugin Name: Disable Emojis
* Plugin URI: https://gist.github.com/chrisdavidmiles/7727d3c4b8b8967f87e6ff0338b8297c
* Description: Disable the automatic emoji replacement in post content and prevent the use of the s.w.org emoji cdn on the site.
* Author: Chris David Miles
* Version: 0.1
*/
@chrisdavidmiles
chrisdavidmiles / auto-rename-uploads-to-match-post-slug.php
Last active Aug 25, 2022 — forked from filipecsweb/functions.php
WordPress Plugin: Auto Rename Uploads to Match Post Slug
View auto-rename-uploads-to-match-post-slug.php
<?php
/**
* Plugin Name: Auto Rename Uploads to Match Post Slug
* Plugin URI: https://gist.github.com/chrisdavidmiles/770ffbfe428b440fd007bcb6b08e94d7
* Description: Uploads will be automatically renamed to match the post slug
* Author: Chris David Miles
* Version: 0.1
*/
function auto_rename_uploads_to_post_slug( $filename ) {
@chrisdavidmiles
chrisdavidmiles / cdm-require-auth.php
Last active Aug 24, 2022
WordPress Plugin: Require Auth
View cdm-require-auth.php
<?php
/**
* Plugin Name: Require Auth
* Plugin URI: https://gist.github.com/chrisdavidmiles/01ad21767394d6b3770197667c32526a
* Description: Users must be logged in to WordPress to see site content. If a user is not authenticated, they will be redirected to the login screen.
* Author: Chris David Miles
* Version: 0.1
*/
if ( ! defined( 'ABSPATH' ) ) die;
@chrisdavidmiles
chrisdavidmiles / cdm-custom-uploads-directory-by-file-type.php
Last active Aug 24, 2022 — forked from blainerobison/gist:e802658da007e6e806b1
WordPress Plugin: Custom Uploads Directory By File Type
View cdm-custom-uploads-directory-by-file-type.php
<?php
/**
* Plugin Name: Custom Uploads Directory By File Type
* Plugin URI: https://gist.github.com/chrisdavidmiles/a7f3fbf09616b4c445a45310c0f88e05
* Description: This plugin automatically sorts uploads into a folder corresponding to their file type. Images go into <code>/img</code>, documents go into <code>/docs</code>, video goes into <code>/img</code>, and the rest goes into <code>/misc</code>. Note: This code doesn't work with 'browser uploader'.
* Author: Forked from Blaine Robison
* Author URI: https://gist.github.com/blainerobison/e802658da007e6e806b1
* Version: 0.2
*/
@chrisdavidmiles
chrisdavidmiles / cdm-automatically-set-featured-image.php
Last active Aug 24, 2022 — forked from mestrewp/gist:2820465
WordPress Plugin: Automatically Set the Featured Image
View cdm-automatically-set-featured-image.php
@chrisdavidmiles
chrisdavidmiles / cdm-remove-admin-email-verification.php
Last active Jul 24, 2022
WordPress Plugin: Remove Admin Email Verification
View cdm-remove-admin-email-verification.php
<?php
/**
* Plugin Name: Remove Admin Email Verification
* Plugin URI: https://gist.github.com/chrisdavidmiles/94f58cc60fdb34d06a13f946f8ffd155
* Description: Removes the step in /wp-login.php that occasionally asks to confirm if the email on file for a site is still correct.
* Version: 1.0
* Requires at least: 5.3
*/
@chrisdavidmiles
chrisdavidmiles / url-shorteners.txt
Last active Jul 30, 2022
URL shorteners and redirect sites
View url-shorteners.txt
onelink.me/
app.link/
//1click.im/
//1dl.us/
//1o2.ir/
//2tag.nl/
//7.ly/
//9en.us/
//ad7.biz/
//adbooth.com/
@chrisdavidmiles
chrisdavidmiles / 404.html
Created Apr 30, 2022
Internet Explorer 4 - Default 404 Page
View 404.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>404 - Page Not Found</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
<style type="text/css">
<!--
body { background-color: white; color: black; }
#container { width: 400px; }