Woocommerce – get daily sales meta

The question that you posted is unfortunately not all that specific but take a look at Woocommerce analytics. Otherwise there are 2 ways to do this on your own. 1. Query all the orders for day X and count the qty of a specific product. 2. Update the products sold after each purchase. Perhaps to … Read more

Find locations of all featured images of draft posts via SQL

Alright this worked for me: First run the bellow script to generate the file locations of all files used for draft posts. SELECT voybp_posts.guid FROM voybp_posts WHERE voybp_posts.ID IN (SELECT voybp_postmeta.meta_value FROM voybp_postmeta WHERE voybp_postmeta.post_id IN ( SELECT voybp_posts.ID FROM voybp_posts WHERE voybp_posts.post_status=”draft”) AND voybp_postmeta.meta_key=”_thumbnail_id”) Export this as a CSV file and save it to … Read more

What is the equivalent WP_Query of a SQL Query?

Because I don’t have the exact settings, I just make use of the variables showing in the questions to code. The code is tested with similar settings with meta value. If using WP_Query object, one more custom field is required to achieve the effect $queryArgs = [ ‘post_type’ => ‘author_cpt’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => … Read more

Delete oldest wordpress post (SQL query)

I figured it out! Pretty simple actually.. You can replace post_date_gmt with ID depending on your needs. post_author != 1 will prevent the admin’s post from being deleted, so the menu links and pages will stay intact 🙂 function deleteOldestPost(){ global $wpdb; $prefix = $wpdb->prefix; $wpdb->query(“DELETE FROM “.$prefix.”posts where post_author != 1 order by post_date_gmt … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)