Skip to content

Instantly share code, notes, and snippets.

View EarthmanWeb's full-sized avatar

Terrance Orletsky EarthmanWeb

View GitHub Profile
git filter-branch --tree-filter "rm -rf ai1wm-backups" --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo ai1wm-backups/ >> .gitignore
git add .gitignore
git commit -m 'Removing ai1wm-backups from git history'
git gc
git push origin production --force
@EarthmanWeb
EarthmanWeb / instructions
Created August 2, 2023 09:05 — forked from brenes/instructions
Repairing non-monotic index git error
> git fetch
...
error: non-monotonic index .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.idx
...
> rm .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.idx
> git index-pack .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.pack
@EarthmanWeb
EarthmanWeb / plugin-status.php
Last active September 15, 2023 23:00
Adds plugin status page to network admin for WPMS
<?php
/**
* Plugin Name: Plugin Versions
* Description: Adds a Plugin Versions menu in WordPress Network Admin under Plugins.
* Author: Terrance Orletsky - Earthman Media
* Author URI: https://earthmanmedia.com
* Version: 1.0
*/
@EarthmanWeb
EarthmanWeb / wmcc-functions.php
Created September 13, 2023 22:30
TEC 6 fix for WordPress Multisite Content Copier/Updater Pro v3
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit( 'restricted access' );
}
/*
* This is a function that show copier section.
* Show multisite relationships.
*/
if ( ! function_exists( 'wmcc_display_content_copier' ) ) {
@EarthmanWeb
EarthmanWeb / wpms-plugin-list.php
Last active September 19, 2023 20:12
mu-plugin to show status of plugins for all sites in wpms (WordPress multisite)
<?php
/**
* Plugin Name: Plugins Enabled
* Description: Displays the plugin status across all sites in a WordPress Multisite network.
* Author: Terrance Orletsky - Earthman Media
* Author URI: https://earthmanmedia.com
* Version: 1.0.7
*/
add_action( 'network_admin_menu', 'wpms_plugin_list_menu' );
@EarthmanWeb
EarthmanWeb / og-meta-tags.php
Last active November 4, 2023 02:01
SEO / OG Meta Tags
<?php
/**
* Plugin Name: OG Meta Tags
* Description: Adds OG meta tags to the head of the document with dynamic default values.
* Version: 1.0.0
*/
/**
* Adds the SEO meta tags to the head of the document.
*
@EarthmanWeb
EarthmanWeb / gist:f2918d9b3cb7933b75a63bf9b5c217f3
Last active January 4, 2024 21:29
Custom WP caps for media library
function em_setup_media_permissions() {
add_filter( 'user_has_cap', 'em_grant_media_permissions_except_subscriber', 1000, 4 );
}
// add custom caps to enable media permissions for custom roles
function em_grant_media_permissions_except_subscriber( $allcaps, $caps, $args, $user ) {
$post_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : ( isset( $args[2] ) ? $args[2] : null );
if ( ! $post_id ) {
@EarthmanWeb
EarthmanWeb / plugin-versions.php
Last active January 17, 2024 16:38
Add a copy/pasteable plugin update list with quick links to changelogs in wp-admin
<?php
/**
* Plugin Name: Plugin Versions
* Description: Adds a Plugin Versions menu in WordPress Admin under Plugins.
* Author: Terrance Orletsky - Earthman Media
* Author URI: https://earthmanmedia.com
* Version: 1.0.4
*/
@EarthmanWeb
EarthmanWeb / login-logo.php
Last active March 21, 2024 22:56
EM mu-plugin - no frills login customizer for WP
<?php
/**
* Plugin Name: EM Custom Login Logo and Styles
* Description: MU-Plugin - Customizes the login page with a custom logo and styles.
* Author: Terrance Orletsky / ChatGPT
* Version: 2.3.2
*/
add_action( 'login_enqueue_scripts', 'em_custom_login_styles' );
@EarthmanWeb
EarthmanWeb / collect-php-error-log-rsync.sh
Last active June 15, 2024 06:29
Aggregate logs from Pantheon server via Rsync
#!/bin/bash
# Usage from project root
# make sure your default public key (id_rsa.pub) is added to pantheon
# bash /path/to/bash/script/collect-php-error-log-rsync.sh
# ** put this in the folder you also want the '/logs' folder to land in
### SET SCRIPT PARAMS ###
# Site UUID is REQUIRED: Get from Pantheon Dashboard URL
SITE_UUID="12345678-1234-1234-abcd-0123456789ab"