wp-admin redirect loop on https issue

Add below code in wp-config.php file


define(‘FORCE_SSL_ADMIN’, true);
define(‘FORCE_SSL_LOGIN’, true);
if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’)


After updated cart totals Ajax Woocommerce

jQuery( document.body ).on( ‘updated_cart_totals’, function() {

jQuery( document.body ).on( ‘updated_cart_totals’, function() {

jQuery(“#shipping_method_0”).prepend(“<option value=” selected=’selected’>Select Your Shipping Option</option>”);

console.log( ‘cart updated’ );

} );

How to check featured image exist or not in post

$args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1);

$the_query = new WP_Query( $args );
$i = 1;

if ( $the_query->have_posts() ) {

echo ‘<ul>’;

while ( $the_query->have_posts() ) {


if ( has_post_thumbnail() ) {

$dom_url = get_the_post_thumbnail_url();

$new_url = str_replace(‘site_url()’,’/var/www/html/’,get_the_post_thumbnail_url()); if(!file_exists($new_url))


echo ‘<li><b> ‘ .$i. ‘ </b> ‘. get_the_title() . ‘ Page Link:——-‘. get_the_post_thumbnail_url() .'</li>’;





echo ‘</ul>’;


} else {

// no posts found

echo “Number Of Posts: “.$i;

Check root path of image $_SERVER[‘DOCUMENT_ROOT’]

Remove WooCommerce styles and scripts

Remove WooCommerce default css and js of lightbox then implement any plugins like:-

  1. Twist – Woocommerce Product Gallery Slider
  2. Responsive Lightbox


/* Remove WooCommerce styles and scripts. */
function woo_remove_lightboxes() {

// Styles
wp_dequeue_style( ‘woocommerce_prettyPhoto_css’ );

// Scripts
wp_dequeue_script( ‘prettyPhoto’ );
wp_dequeue_script( ‘prettyPhoto-init’ );
wp_dequeue_script( ‘fancybox’ );
wp_dequeue_script( ‘enable-lightbox’ );

add_action( ‘wp_enqueue_scripts’, ‘woo_remove_lightboxes’, 99 );

Remove All products or attributes with SQL commands WooCommerce

Remove all attributes from WooCommerce

DELETE FROM wp_terms WHERE term_id IN 
(SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%');
DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%';
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN 
(SELECT term_taxonomy_id FROM wp_term_taxonomy);

Delete all WooCommerce products

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 
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');

Delete orphaned postmeta

FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id