Skip to content

Instantly share code, notes, and snippets.

View fearlex's full-sized avatar
🎯
Focused

Arleys Resco fearlex

🎯
Focused
View GitHub Profile
@fearlex
fearlex / functions.php
Created September 7, 2022 20:03
Disable Wordpress Auto Update Themes, Plugin & Plugin UI
// Disable Plugin Automatic Updates
add_filter( 'auto_update_plugin', '__return_false' );
// Disable Themes Automatic Updates
add_filter( 'auto_update_theme', '__return_false' );
// Disable plugins auto-update UI elements.
add_filter( 'plugins_auto_update_enabled', '__return_false' );
@fearlex
fearlex / .gitignore
Created May 31, 2020 02:15
QuamtumWP Wordpress .gitignore
### WordPress
## Logs
*.log
## Uploads
wp-content/cache/*
wp-content/et-cache/*
wp-content/upgrade/
wp-content/uploads/*
@fearlex
fearlex / post.sql
Last active March 11, 2019 21:26
Migrate http to https
##-- Images Double Quote
UPDATE `wp_posts` SET post_content = ( Replace (post_content, 'src="http://', 'src="//') )
WHERE Instr(post_content, 'jpeg') > 0
OR Instr(post_content, 'jpg') > 0
OR Instr(post_content, 'gif') > 0
OR Instr(post_content, 'png') > 0;
##-- Images Single Quote
UPDATE `wp_posts` SET post_content = ( Replace (post_content, "src='http://", "src='//") )
WHERE Instr(post_content, 'jpeg') > 0
@fearlex
fearlex / wp.sql
Created March 11, 2019 20:33
Wordpress/Woocommerce Cleanups
##-- Delete All Transients
DELETE FROM `wp_options` WHERE `option_name` LIKE '%_transient_%';
##-- Remove any WooCommerce wc_sessions from your database.
DELETE FROM wp_options
WHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%';
##-- Remove any transients set by WooCommerce from your database.
DELETE FROM wp_options
WHERE option_name LIKE '_transient_wc_%' OR option_name LIKE '_transient_timeout_wc_%';
@fearlex
fearlex / innodb.sql
Created March 11, 2019 20:25
InnoDB Checks
##-- Show current operations being performed
SHOW FULL PROCESSLIST;
##-- Check InnoDB status for locks
SHOW ENGINE InnoDB STATUS;
##-- Check MySQL open tables
SHOW OPEN TABLES WHERE In_use > 0;
##-- Check pending InnoDB transactions
@fearlex
fearlex / .htaccess
Created March 11, 2019 20:15
Wordpress .htaccess utils
#Force non-www
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule (.*) https://domain.com%{REQUEST_URI} [L,R=301,NC]
#Redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# add a trailing slash to /wp-admin
@fearlex
fearlex / wp.sql
Created March 10, 2019 14:35
Woocommerce Orders queries
##-- Show Orders Current Postmeta
SELECT DISTINCT pm.meta_key FROM wp_postmeta AS pm LEFT JOIN wp_posts AS p ON p.ID = pm.post_id WHERE p.post_type = 'shop_order';
##-- Show Last 20 Orders
SELECT SQL_CALC_FOUND_ROWS hush_posts.ID
FROM hush_posts
WHERE 1=1
AND hush_posts.post_type = 'shop_order'
AND ((hush_posts.post_status = 'wc-pending'
OR hush_posts.post_status = 'wc-processing'
@fearlex
fearlex / wp.sql
Last active March 11, 2019 20:32
Wordpress MySQL wp_options queries
##-- Show WP autoload options length on wp_options table
SELECT option_name, LENGTH(option_value), autoload FROM wp_options ORDER BY autoload DESC, option_name ASC;
##-- Display LENGTH of option_value in wp_options table
SELECT option_name, LENGTH(option_value), autoload FROM wp_options ORDER BY option_value DESC, option_name ASC;
##-- Autoloaded data size, how many entries are in the table, and the first 10 entries by size
SELECT 'autoloaded data in KiB' as name, ROUND(SUM(LENGTH(option_value))/ 1024) as value FROM wp_options WHERE autoload='yes'
UNION SELECT 'autoloaded data count', count(*) FROM wp_options WHERE autoload='yes'
UNION (SELECT option_name, length(option_value) FROM wp_options WHERE autoload='yes' ORDER BY length(option_value) DESC LIMIT 10)
@fearlex
fearlex / woocommerce.php
Created March 10, 2019 14:14
Woocommerce Debugging
$logger = wc_get_logger();
$logger->debug( $VARIABLE_TO_OUTPUT, array( 'source' => 'LOGNAME' ) );
@fearlex
fearlex / robots.txt
Created March 10, 2019 14:11
Woocommerce optimized robots.txt configuration
User-agent: *
Disallow: /wp-admin/
Disallow: /*add-to-cart=*
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
Allow: /wp-admin/admin-ajax.php