This file contains 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 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 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 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 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 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 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() ) { |
This file contains 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
Index: functions/actions.php | |
=================================================================== | |
--- functions/actions.php (revision 43062) | |
+++ functions/actions.php (working copy) | |
@@ -1004,8 +1004,9 @@ | |
} | |
if (!is_admin() && is_active_widget('Suffusion_Google_Translator', false, 'suf-google-translator', true)) { | |
+ $protocol = is_ssl() ? 'https' : 'http'; | |
// For some reason the translation widget fails if we load the JS in the header. Hence we are overriding the header/footer JS setting |
This file contains 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
if [ ! -f menus.wxr ]; then | |
echo "You need to export the menus for the menu setting to work, export to a menus.wxr file" | |
echo "remember to export the 'nav_menu_item' post type to a menus.wxr file before running" | |
exit; | |
fi | |
# Get a list of blogs to loop through | |
blogs=$(wp site list --fields="site_id,blog_id,url" --format="csv" --path="../../repository/htdocs/wp") | |
for entry in $blogs |
This file contains 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 | |
if ( ! defined( 'PJID' ) ) define( 'PJID', uniqid() ); | |
function pj_error_log(){ | |
// Get line numbers and such | |
$bt = debug_backtrace(); | |
$caller = array_shift($bt); | |
// First we check if we're being asked to print a pretty message | |
if ( func_num_args() == 2 && is_string( func_get_arg(0) ) ) { |
NewerOlder