Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Arleys Resco fearlex

🎯
Focusing
Block or report user

Report or block fearlex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fearlex
fearlex / .gitignore
Created May 31, 2020
QuamtumWP Wordpress .gitignore
View .gitignore
### WordPress
## Logs
*.log
## Uploads
wp-content/cache/*
wp-content/et-cache/*
wp-content/upgrade/
wp-content/uploads/*
@fearlex
fearlex / post.sql
Last active Mar 11, 2019
Migrate http to https
View post.sql
##-- 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 Mar 11, 2019
Wordpress/Woocommerce Cleanups
View wp.sql
##-- 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_%';
View innodb.sql
##-- 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 Mar 11, 2019
Wordpress .htaccess utils
View .htaccess
#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 Mar 10, 2019
Woocommerce Orders queries
View wp.sql
##-- 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 Mar 11, 2019
Wordpress MySQL wp_options queries
View wp.sql
##-- 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 Mar 10, 2019
Woocommerce Debugging
View woocommerce.php
$logger = wc_get_logger();
$logger->debug( $VARIABLE_TO_OUTPUT, array( 'source' => 'LOGNAME' ) );
@fearlex
fearlex / robots.txt
Created Mar 10, 2019
Woocommerce optimized robots.txt configuration
View robots.txt
User-agent: *
Disallow: /wp-admin/
Disallow: /*add-to-cart=*
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
Allow: /wp-admin/admin-ajax.php
@fearlex
fearlex / style.css
Created Jun 7, 2017
Contact Form 7 - Better basic error style
View style.css
div.wpcf7 span.wpcf7-not-valid-tip {
width: 100%;
min-width: 200px;
position: absolute;
top: 52px !important;
left: 0;
font-size: 0.8em;
}
div.wpcf7 div.wpcf7-validation-errors {
You can’t perform that action at this time.