This file contains hidden or 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 | |
/* | |
Plugin Name: Convert Custom Taxonomy to Custom Post Type | |
Plugin URI: N/A | |
Description: A plugin to convert a Custom Taxonomy to a Custom Post Type and transfer associated metadata. | |
Version: 0.1 | |
Author: Strap1 | |
Author URI: http:/www.hiphopinenglish.com | |
/** Convert Taxonomy '%name%' to CPT '%name%' **/ |
This file contains hidden or 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 the discount details of given product with custom price | |
* @param $price float/integer | |
* @param $product object (Product object Example: wc_get_product($product_id)) | |
* @param $quantity int | |
* @param $custom_price float/integer (0 for calculate discount from product price) | |
* @param $return_details string (Default value 'discounted_price' accepted values = 'discounted_price','all') | |
* @param $manual_request boolean (Default value false: pass this as true for get discount even if there is no item in cart) | |
* @param $is_cart boolean (Default value true) | |
* @return array|float|int - is product has no discounts, returns $price;else return array of discount details based on $return_details |
This file contains hidden or 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 hidden or 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 FROM wp_woocommerce_order_itemmeta; | |
DELETE FROM wp_woocommerce_order_items; | |
DELETE FROM wp_comments WHERE comment_type = 'order_note'; | |
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' ); | |
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_subscription' ); | |
DELETE FROM wp_posts WHERE post_type = 'shop_order'; | |
DELETE FROM wp_posts WHERE post_type = 'shop_subscription'; |
This file contains hidden or 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 FROM wp_term_relationships WHERE object_id IN | |
(SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation')); | |
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN | |
('product','product_variation')); | |
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation'); |
This file contains hidden or 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 v.value | |
FROM `eav_attribute` a | |
INNER JOIN `eav_attribute_option` o ON a.`attribute_id` = o.`attribute_id` | |
INNER JOIN `eav_attribute_option_value` v ON v.`option_id` = o.`option_id` | |
INNER JOIN `eav_entity_type` t ON t.`entity_type_id` = a.`entity_type_id` | |
LEFT JOIN `catalog_product_entity_int` pi ON o.`option_id` = pi.`value` AND o.`attribute_id` = pi.`attribute_id` | |
LEFT JOIN `catalog_product_entity_varchar` pv ON o.`option_id` = pv.`value` AND o.`attribute_id` = pv.`attribute_id` | |
WHERE pi.`entity_id` IS NULL | |
AND pv.`entity_id` IS NULL | |
AND t.`entity_type_code` = "catalog_product" |
This file contains hidden or 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
// step 1, create temporary table | |
// get attribute from eav_attribute table, entity_type_id = 3 for category | |
CREATE TABLE _category_order | |
SELECT | |
e.entity_id AS 'entity_id', | |
ce.value AS 'name', | |
e.position AS 'current_position' | |
'1' AS 'new_position' | |
FROM |
This file contains hidden or 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
Verifying that "dvdmierden.id" is my Blockstack ID. https://onename.com/dvdmierden |