Skip to content

Instantly share code, notes, and snippets.


Simon Blackbourn lumpysimon

View GitHub Profile
lumpysimon / .htaccess
Created Jun 16, 2019
.htaccess short WordPress URLs
View .htaccess
# e.g.
RewriteEngine On
RewriteRule ^go/([0-9]+)$ ?p=$1 [R=301,L]
lumpysimon / delete-spam-comment.sql
Created Jun 16, 2019
MySQL commands to delete spam WordPress comments & commentmeta
View delete-spam-comment.sql
delete from wp_comments where comment_approved='spam';
delete from wp_commentmeta where comment_id not in (select comment_id from wp_comments);
delete from wp_commentmeta where meta_key like '%akismet%';
lumpysimon / limit-checkboxes.js
Created Jun 16, 2019
jQuery snippet to limit how many checkboxes can be checked
View limit-checkboxes.js
$( '.things' ).click( function() {
var bol = $( '.things:checked' ).length >= 8;
$( '.things' ).not( ':checked' ).attr( 'disabled', bol );
// from
lumpysimon / dequeue-wordpress-block-library-styles.php
Last active Jan 4, 2019
Dequeue the WordPress block editor stylesheet if the Classic Editor plugin is activated and configured
View dequeue-wordpress-block-library-styles.php
add_action( 'wp_enqueue_scripts', 'simon_dequeue_block_editor_styles' );
function simon_dequeue_block_editor_styles() {
if ( 'classic' === get_option( 'classic-editor-replace' ) ) {
wp_dequeue_style( 'wp-block-library' );
lumpysimon / tiny-mce.php
Last active Dec 5, 2018
Configure the default WordPress TinyMCE behaviour, defaults and buttons
View tiny-mce.php
defined( 'ABSPATH' ) or die();
$lumpy_lemon_tiny_mce = new lumpy_lemon_tiny_mce;
lumpysimon / .htaccess
Last active Aug 1, 2018
.htaccess file for WordPress sites, with Strict Transport Security header and various caching improvements
View .htaccess
Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS
Header set X-Powered-By "WordPress and Lumpy Lemon"
AddDefaultCharset UTF-8
<IfModule mod_mime.c>
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
<IfModule mod_headers.c>
lumpysimon / meta-tags.php
Last active Jul 10, 2018
Kirby meta tags config file
View meta-tags.php
c::set('meta-tags.default', function(Page $page, Site $site) {
if ( $page->isErrorPage() )
return [
'title' => $page->title()
$title = ( $page->isHomePage() ? $site->title() : $page->title() . ' - ' . $site->title() );
lumpysimon / vs-code-settings.json
Last active Jun 15, 2020
VS Code workplace settings with title bar colouring
View vs-code-settings.json
"folders": [
"path": "/path/to/my/workspace/folder"
"settings": {
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#d12229",
"titleBar.activeForeground": "#ffffff",
lumpysimon / .lando.yml
Created May 16, 2018
Lando config file for Kirby with Apache, PHP 7.2, SSL and MailHog
View .lando.yml
name: kirby
type: php:7.2
via: apache
lumpysimon / .lando.yml
Last active Oct 9, 2020
Lando config file for WordPress with Nginx, PHP 7.2, MySQL 5.5, Xdebug, MailHog and PHPMyAdmin
View .lando.yml
name: mysite2
recipe: wordpress
php: '7.2'
via: nginx
webroot: public
xdebug: true
php: .vscode/php.ini
You can’t perform that action at this time.