This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# iterate-by-date.sh - A template script for looping through days/months/years and running a command that takes | |
# before and after arguments. | |
# | |
# Usage: ./iterate-by-date.sh [iterate_by] [start_date] [end_date] | |
# | |
# Options: | |
# - iterate_by: The granularity of the operation - day, month or year (default: day). | |
# - start_date: The start date for the operation in YYYY-MM-DD format (default: 30 days ago). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": [ "." ], | |
"themes": [ "WordPress/twentytwentyfive" ] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WordPress dependencies | |
*/ | |
import { unregisterBlockVariation, registerBlockVariation } from '@wordpress/blocks' | |
import { addFilter } from '@wordpress/hooks'; | |
import { registerPlugin } from '@wordpress/plugins'; | |
import { select, subscribe } from '@wordpress/data'; | |
/** | |
* Internal dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE: watch_sync [destination_folder] | |
# Watch and sync a folder | |
watch_sync() { | |
# The first and only argument is the folder to sync to. | |
TO=$(echo "$1" | sed 's/\/$//') | |
# We assume the current folder is the one to sync from. | |
FROM=$(pwd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all users with a role of "subscriber" from a WordPress database. | |
# | |
# Assumes the `wp_` table prefix | |
DELETE FROM wp_users WHERE ID IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%subscriber%' ); | |
DELETE FROM wp_usermeta WHERE user_id IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%subscriber%' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Scroll Snap</title> | |
<style type="text/css"> | |
* { | |
box-sizing: border-box; | |
} | |
.scroll-container { | |
max-height: 100vh; | |
overflow-y: scroll; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Migrate from WP User Avatar to Simple Local Avatars | |
Allows sites to easily move away from the WP User Avatar plugin and switch to Simple Local Avatars instead. | |
Run by invoking with WP CLI like so: | |
`wp eval-file migrate-wp-user-avatar.php` | |
Author: Philip John |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Rename Comments | |
* Description: Provides themes with the ability to allow users to rename comments. | |
* Version: 0.1.0 | |
* Author: Philip John, Automattic | |
* Author URI: https://automattic.com | |
* Text Domain: rename-comments | |
* Domain Path: /languages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Time to Publish | |
Plugin URI: https://vip.wordpress.com | |
Description: Track "Time to Publish" on your WordPress site. | |
Version: 0.1.0 | |
Author: WordPress.com VIP | |
Author URI: http://vip.wordpress.com | |
Text Domain: time_to_publish | |
Domain Path: /languages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'pre_update_option', 'll_kill_frontend_rewrite_rules_update', 10, 3 ); | |
function ll_kill_frontend_rewrite_rules_update( $value, $option, $old_value ) { | |
// We're only concerned with the rewrite rules option. | |
if ( 'rewrite_rules' !== $option ) { | |
return $value; | |
} | |
// We want to concentrate on frontend requests only. | |
if ( ! is_admin() && ! is_user_logged_in() ) { |
NewerOlder