Skip to content

Instantly share code, notes, and snippets.

View tekapo's full-sized avatar

Tai / JOTAKI Taisuke tekapo

View GitHub Profile
@salcode
salcode / .editorconfig
Last active October 15, 2022 21:22
WordPress .editorconfig - modified version of the WordPress coding standards
# EditorConfig helps keep your project formatting consistent.
# See https://EditorConfig.org
#
# This is a modified version of the WordPress coding standards.
#
# Author: Sal Ferrarello (@salcode)
# https://salferrarello.com/wordpress-editorconfig/
#
# You can download this file directly
# to your project from the command-line with
@tetsuharu-kono
tetsuharu-kono / wifi_site_survey.sh
Last active January 30, 2023 00:14
Wi-Fi site survey script for macOS
#!/bin/zsh
# Wi-Fi Site Survey
# 2020.07.22 Rev. 0.1
# First release
# 2023.01.30 Rev. 0.2
# Fixed channel and BSSID not being retrieved by Monterey
# Fail on unset variables and command errors
set -ue -o pipefail
@hughc
hughc / gutenberg-audit.php
Created April 20, 2020 10:36
Gutenberg Audit for WordPress
<?php
/*
Plugin Name: Gutenberg Audit
Plugin URI: http://highbrow.com.au/plugins/gutenberg-audit
description: What blocks is your site using?
Version: 0.1
Author: Hugh Campbell
Author URI: http://highbrow.com.au/
License: GPL2
*/
@wokamoto
wokamoto / replace-siteurl.php
Created September 4, 2012 23:22
WordPress のDB上のサイトURLを一気に変換
#!/usr/bin/php
<?php
switch($argc) {
case 1:
case 2:
echo "please input new site url and wp directory name!\n";
exit();
default:
$old_site = isset($argv[3]) ? $argv[3] : '';
$path = $argv[2];
@skorasaurus
skorasaurus / example1.md
Last active November 11, 2023 17:19
Manage WordPress via WP-CLI with these Shortcuts/scripts/functions/aliases.

update text inside a post (we work with 3rd party vendors, their urls occasionally change; or we changed a campaign's name used in google analytics) and limit it to ONLY published posts. (sometimes, our marketing team wants to what see how content was EXACTLY in the past). wp-cli's search-replace command by default make edits in revisions.

(in this command, 'before' is what you want to get rid of and 'after' is what you want to replace 'before' with.

wp db query "UPDATE $(wp db tables "*_posts") SET post_content = REPLACE(post_content, 'before', 'after') WHERE post_status = 'publish';"