very useful when you can have an attachment with the same slug as a post record_exists_by_slug You can check the post if it exists as an attachment you can change, this way it is practically impossible to duplicate a post
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
$(function() { | |
// for bootstrap 3 use 'shown.bs.tab', for bootstrap 2 use 'shown' in the next line | |
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { | |
// save the latest tab; use cookies if you like 'em better: | |
localStorage.setItem('lastTab', $(this).attr('href')); | |
}); | |
// go to the latest tab, if it exists: | |
var lastTab = localStorage.getItem('lastTab'); | |
if (lastTab) { |
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 | |
function simpleCachedCurl($url) { | |
$hash = md5($url); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
#curl_setopt( $ch, CURLOPT_COOKIEJAR, $cookie ); | |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); | |
curl_setopt( $ch, CURLOPT_ENCODING, "utf-8" ); | |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); | |
curl_setopt( $ch, CURLOPT_AUTOREFERER, true ); |
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 FROM wpcs_woocommerce_order_itemmeta; | |
DELETE FROM wpcs_woocommerce_order_items; | |
DELETE FROM wpcs_comments WHERE comment_type = 'order_note'; | |
DELETE FROM wpcs_postmeta WHERE post_id IN ( SELECT ID FROM wpcs_posts WHERE post_type = 'shop_order' ); | |
DELETE FROM wpcs_posts WHERE post_type = 'shop_order'; |
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 your-state "Selecione seu estado" "AC|Acre" "AL|Alagoas" "AP|Amapá" "AM|Amazonas" "BA|Bahia " "CE|Ceará" "DF|Distrito Federal " "ES|Espírito Santo" "GO|Goiás" "MA|Maranhão" "MT|Mato Grosso" "MS|Mato Grosso do Sul" "MG|Minas Gerais" "PA|Pará" "PB|Paraíba" "PR|Paraná" "PE|Pernambuco" "PI|Piauí" "RJ|Rio de Janeiro" "RN|Rio Grande do Norte" "RS|Rio Grande do Sul" "RO|Rondônia" "RR|Roraima" "SC|Santa Catarina" "SP|São Paulo" "SE|Sergipe" "TO|Tocantins"] |
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
$text = "A strånge string to pass, maybe with søme ø, æ, å characters."; | |
foreach(mb_list_encodings() as $charset){ | |
echo mb_convert_encoding($text, 'UTF-8', $charset)." : ".$charset."<br>"; | |
} |
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 all WooCommerce products | |
DELETE FROM wpcl_term_relationships WHERE object_id IN (SELECT ID FROM wpcl_posts WHERE post_type IN ('product','product_variation')); | |
DELETE FROM wpcl_postmeta WHERE post_id IN (SELECT ID FROM wpcl_posts WHERE post_type IN ('product','product_variation')); | |
DELETE FROM wpcl_posts WHERE post_type IN ('product','product_variation'); | |
-- Delete all WooCommerce terms | |
DELETE a,c FROM wpcl_terms AS a | |
LEFT JOIN wpcl_term_taxonomy AS c ON a.term_id = c.term_id | |
LEFT JOIN wpcl_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id | |
WHERE c.taxonomy = 'product_tag'; | |
-- Delete All WooCommerce relationships |
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 order_item_name, | |
order_id,meta.order_item_id meta_item, | |
meta.meta_key meta_key, | |
meta.meta_value meta_value | |
FROM `unf_woocommerce_order_items` items | |
LEFT JOIN unf_woocommerce_order_itemmeta meta ON meta.order_item_id = items.order_item_id | |
WHERE order_id = 458 |
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 | |
require dirname(__FILE__).'/wp-blog-header.php'; | |
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')"); | |
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')"); |