Skip to content

Instantly share code, notes, and snippets.

View peterjohnhunt's full-sized avatar

PeterJohn Hunt peterjohnhunt

View GitHub Profile
@peterjohnhunt
peterjohnhunt / divi-builder-shortcode-removal.sh
Last active November 18, 2022 15:22
WP CLI Delete Divi Builder Shortcodes
wp search-replace '\[\/?et_pb.*?\]' '' --regex
<?php
/**
* Import Specs CLI
*
* @subcommand specs
*
* ## EXAMPLES
*
* wp import file
*
@peterjohnhunt
peterjohnhunt / basecamp.js
Last active April 19, 2021 20:32
Scriptkit Basecamp API Library
let express = await npm('express')
let parseLinkHeader = await npm('parse-link-header')
//≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
// ✅ Database
//≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
let basecampDb = db("basecamp", {
client_id: null,
let express = await npm('express')
//≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
// ✅ Database
//≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
let zoomDb = db("zoom", {
client_id: null,
client_secret: null,
# Optional Local Debug
# wp config set WP_DEBUG true --raw
# wp config set WP_DEBUG_DISPLAY false --raw
# wp config set WP_DEBUG_LOG true --raw
# Setup defaults
wp post create --post_type=page --post_title=Home --post_status=publish --post_author=1
wp option update show_on_front 'page'
wp option update page_on_front $(wp post list --post_type=page --post_status=publish --posts_per_page=1 --pagename=home --field=ID --format=ids)
wp option update blogdescription ''
function custom_display_post_states( $states, $post ) {
$note = get_post_meta($post->ID, 'MY_META_FIELD_HERE', true);
if ( $note && !isset($states['note']) ) {
$states['note'] = $note;
}
return $states;
}
mkdir db
wp db export db/backup.sql &&
wp @production db export - > db/latest-db.sql &&
wp db import db/latest-db.sql &&
wp option set blog_public 0
# Single Site
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteRule ^(.*)$ http://PRODUCTIONSITE/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d