Skip to content

Instantly share code, notes, and snippets.

Avatar
🌏
No to War

Luke Cavanagh lukecav

🌏
No to War
View GitHub Profile
@lukecav
lukecav / Links
Created Oct 4, 2022
Remove WooCommerce Payments banner in wp-admin
View Links
@lukecav
lukecav / Custom database tables
Created Oct 4, 2022
Independent Analytics plugin custom database tables
View Custom database tables
wp_independent_analytics_campaign_urls
wp_independent_analytics_campaigns
wp_independent_analytics_referrer_groups
wp_independent_analytics_referrers
wp_independent_analytics_resources
wp_independent_analytics_views
wp_independent_analytics_visitors
@lukecav
lukecav / Query
Last active Oct 4, 2022
MySQL script to get all WooCommerce orders including metadata
View Query
select
p.ID as order_id,
p.post_date,
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_email,
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_first_name,
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_last_name,
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_1,
max( CASE WHEN pm.meta_key = '_billing_address_2' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_address_2,
max( CASE WHEN pm.meta_key = '_billing_city' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_city,
max( CASE WHEN pm.meta_key = '_billing_state' and p.ID = pm.post_id THEN pm.meta_value END ) as _billing_state,
@lukecav
lukecav / Links
Created Oct 3, 2022
Wordfence plugin caused high CPU usage
View Links
@lukecav
lukecav / wp-config.php
Created Oct 3, 2022
All In One WP Security & Firewall plugin disable login whitelisting
View wp-config.php
define('AIOS_DISABLE_LOGIN_WHITELIST', true);
@lukecav
lukecav / Custom database tables
Last active Oct 3, 2022
FluentCRM plugin custom database tables
View Custom database tables
wp_fc_contact_relations
wp_fc_contact_relation_items
wp_fc_campaign_emails
wp_fc_campaign_url_metrics
wp_fc_campaigns
wp_fc_funnel_metrics
wp_fc_funnel_sequences
wp_fc_funnel_subscribers
wp_fc_lists
wp_fc_meta
@lukecav
lukecav / functions.php
Created Sep 30, 2022
Exclude WooCommerce Sessions and Action Scheduler Log in search and replace in WP Staging plugin
View functions.php
function wpstg_searchreplace_excl_tables($default){
$tables = array('_woocommerce_sessions', '_actionscheduler_logs');
return array_merge($default, $tables);
}
add_filter('wpstg_searchreplace_excl_tables','wpstg_searchreplace_excl_tables');
@lukecav
lukecav / DNS Prefetch domains
Last active Sep 28, 2022
WP Rocket - Advanced Options Prefetch DNS requests examples
View DNS Prefetch domains
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
@lukecav
lukecav / Commands
Last active Sep 26, 2022
Speed up wp db export using WP-CLI
View Commands
# Export site database using wp db export
wp db export /wp-content/wordpress-dump.sql --all-tablespaces --single-transaction --quick --lock-tables=false
# Gzip compress the recent database export
gzip wordpress-dump.sql
# Export sites database using wp db export and gzip compress
wp db export --all-tablespaces --single-transaction --quick --lock-tables=false - | gzip -9 - > wordpress-dump.sql.gz
@lukecav
lukecav / .htaccess
Last active Sep 26, 2022
Apache - Browser caching and mod_deflate for WordPress
View .htaccess
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/schema+json
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf