This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete | |
p,pm | |
from wp_posts p | |
join wp_postmeta pm on pm.post_id = p.id | |
where p.post_type = 'shop_order'; | |
delete | |
p,pm | |
from wp_posts p | |
join wp_postmeta pm on pm.post_id = p.id | |
where p.post_type = 'shop_subscription'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/^\d+(\s[A-Z]*[a-z]*[.]*){1,}(\s\d*)*$/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- to open reviews for currently added products | |
UPDATE wp_posts SET comment_status = 'open' WHERE post_type = 'product'; | |
-- to close reviews | |
UPDATE wp_posts SET comment_status = 'closed' WHERE post_type = 'product'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Traditional way | |
$array = array('0', '1', '2'); | |
foreach ($array as $key => $var) { | |
$array[$key] = (int)$var; | |
} | |
// The nice way | |
$array = array('0', '1', '2'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_checkout_form', 'custom_payment_overlay' ); | |
function custom_payment_overlay(){ | |
echo sprintf('<div class="custom-payment-popup"><div class="wpt-payment-overlay"></div><div class="wpt-payment-message">%s</div></div>', | |
'We are processing your payment. Please hold on and do not refresh your browser.' | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete | |
u,um | |
from wp_users u | |
join wp_usermeta um on um.user_id = u.id | |
where um.meta_key = 'wp_user_level' and um.meta_value = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete | |
p,pm | |
from wp_posts p | |
join wp_postmeta pm on pm.post_id = p.id | |
where p.post_type = 'companies' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp user list --field=ID --role=customer | xargs wp user delete --yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows only domains with "." for example "example.com" | |
^(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}$ | |
This allows also one-name domains like "localhost". "." is optional | |
^(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.?){1,126}(?!\d+)[a-zA-Z\d]{1,63}$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( !preg_match('/^(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}$/', $domain) ){ | |
// didn't match return error | |
return false; | |
} |
NewerOlder