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
all_coupons=($(wp wc shop_coupon list --user=1 --field=id)) | |
for i in $all_coupons; do | |
wp wc shop_coupon delete $i --user=1 | |
done |
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
SELECT wp_posts.ID, wp_postmeta.meta_value AS sku, wp_posts.post_title AS title, wp_postmeta2.meta_value AS price FROM wp_posts | |
LEFT JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_sku' ) | |
LEFT JOIN wp_postmeta AS wp_postmeta2 ON (wp_posts.ID = wp_postmeta2.post_id AND wp_postmeta2.meta_key = '_price' ) | |
WHERE wp_posts.post_type = 'product' | |
OR wp_posts.post_type = 'product_variation' |
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
SELECT wp_posts.ID, wp_postmeta.meta_value AS sku, wp_posts.post_title AS title, wp_postmeta2.meta_value AS image, wp_postmeta3.meta_value AS gallery FROM wp_posts | |
LEFT JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_sku' ) | |
LEFT JOIN wp_postmeta AS wp_postmeta2 ON (wp_posts.ID = wp_postmeta2.post_id AND wp_postmeta2.meta_key = '_thumbnail_id' ) | |
LEFT JOIN wp_postmeta AS wp_postmeta3 ON (wp_posts.ID = wp_postmeta3.post_id AND wp_postmeta3.meta_key = '_product_image_gallery' ) | |
WHERE wp_posts.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
<script id="mcjs"> | |
!function(c,h,i,m,p){m = c.createElement(h), p = c.getElementsByTagName(h)[0], m.async = 1, m.src = i, p.parentNode.insertBefore(m, p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/XXXXX/XXXXX.js"); | |
window.dataLayer = window.dataLayer || []; | |
var mailchimpObserver = new MutationObserver(function(mutations_list) { | |
mutations_list.forEach(function (mutation) { | |
mutation.addedNodes.forEach(function (added_node) { | |
if (added_node.id == 'PopupSignupForm_0') { | |
window.dataLayer.push({ event: 'mailchimp_popup_shown' }); | |
document.querySelector('#PopupSignupForm_0 div.mc-modal iframe').contentDocument.querySelector('form').addEventListener('submit', function (event) { |
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 | |
/** | |
* Alter the pagination next and prev links to have rel. | |
* | |
* @param string $r HTML output. | |
* @param array $args An array of arguments. See paginate_links() for information on accepted arguments. | |
* | |
* @return sting - The HTML output of the pagination. | |
*/ | |
function scaffolding_add_rel_pagination( $r, $args ) { |
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
#--- Remove all users, except Admins and Shop_Managers --- | |
#--Create a temp table based on the one we want to clear. | |
CREATE OR REPLACE TABLE `temp_usermeta` LIKE `wp_usermeta`; | |
#--Insert the data we want to keep. | |
INSERT INTO `temp_usermeta` SELECT * FROM `wp_usermeta` WHERE user_id IN ( SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' AND meta_value LIKE '%shop_manager%' OR meta_value LIKE '%administrator%' ); | |
#--Drop the table. | |
DROP TABLE `wp_usermeta`; | |
#--Rename to temp table to replace the dropped table. | |
RENAME TABLE `temp_usermeta` TO `wp_usermeta`; |
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 is a sample Pa11y CI config JavaScript file with all available options with their default settings and notes. | |
* | |
* By default, Pa11y CI looks for a config file in the current working directory, named .pa11yci.JSON file. | |
* You can use the --config command line argument to specify this JavaScript file. | |
* | |
* The purpose of this file is to provide an example configuration file users and experiment with in altering the default settings. | |
* | |
* Resources: | |
* https://github.com/pa11y/pa11y-ci#configuration |
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
/* Get all the users missing a first_name. */ | |
SELECT * FROM wp_usermeta AS A | |
WHERE A.meta_key = 'first_name' | |
AND A.meta_value = ''; | |
/* Updated to first_name to their billing_first_name if available. */ | |
UPDATE wp_usermeta AS A | |
JOIN ( SELECT user_id, meta_value FROM `wp_usermeta` WHERE wp_usermeta.meta_key = 'billing_first_name' AND wp_usermeta.meta_value <> '') AS B | |
ON A.user_id = B.user_id | |
SET A.meta_value = B.meta_value |
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 | |
/** | |
* Update the Login URL to the WooCommerce My Account Page. | |
* | |
* @param string $login_url The login URL. Not HTML-encoded. | |
* @param string $redirect The path to redirect to on login, if supplied. | |
* @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. | |
* | |
* @return string The login URL. Not HTML-encoded. | |
*/ |
NewerOlder