Category: Development

Relevanssi: How to Exclude WooCommerce Product Variations From WordPress Search Results

By default, Relevanssi doesn’t un-include search results that are draft, pending, private, etc. This is problematic since you may not want products to be available via search. This solution takes a product variation’s parent post status into account. If the

Posted in: Code Samples, Development  |  Tagged with: , , ,  |  Leave a comment

VaultPress Is Awesome, But Not Realtime For Plugins Like WooCommerce

Update 13 July 2016: According to VaultPress support, WooCommerce tables are now backed up realtime just like core WordPress tables. However, non-WooCommerce and non-WordPress core tables are still only backed up once a day. So if you have custom tables

Posted in: Development, News  |  Tagged with: , , , ,  |  Leave a comment

SQL Script To Get All WooCommerce Orders Including Metadata

A client of mine has a rather large WooCommerce database. We’ve been trying to run reports using the WooCommerce Customer/Order CSV Export plugin but have been running into timeout issues—the glorious WordPress white screen of death. I got fed up

Posted in: Code Samples, Development  |  Tagged with: , , ,  |  Leave a comment

Move Your Damn WordPress Debug Log so It’s Not Accessible via HTTP

Every time I need to view a WordPress debug log, I get a little belly-side security loophole cringe. It completely depends on what information you stuff into it that would cause a security issue, but it’s so easy to mitigate

Posted in: Code Samples, Development  |  Tagged with: , ,  |  Leave a comment

Convert A Massive CSV To Many CSVs Using PHP

I’m in the process of working in a CSV file with roughly 26000+ rows and 20 some odd columns. Each row represents an historical purchase order, including information such as date, time, name, address, product name, product sku, etc. My

Posted in: Code Samples, Development  |  Tagged with: , ,  |  Leave a comment

Run Your Own Damn Code after PayPal Calls WooCommerce Back

This isn’t rocket science, but the WooCoommerce documentation (as robust and complete as it is) isn’t clear about how to hook into a PayPal IPN successful charge webhook call back thingy—yes, that’s its technical name. In fact “isn’t clear” insinuates

Posted in: Code Samples, Development  |  Tagged with: , , ,  |  Leave a comment

MySQL: Group By Column And Include Its Count

Without going into too much detail about the why, consider the below table. It’s a snippet of a table I’m working with for an e-commerce site. Any user (user_id) can have different products (product_id), but any user can also have

Posted in: Code Samples, Development  |  Tagged with:  |  Leave a comment

WooCommerce: How To “Trash” All Orders Really Fast

Some context I am working on a WooCommerce installation where I’m dealing with literally thousands of historical orders. All of which I am programmatically importing (including user accounts!) and doing a bunch of special updates, which are numerous and complicated,

Posted in: Code Samples, Development  |  Tagged with: , ,  |  Leave a comment

“Can You Throw This up on the Website?”

In my profession, occasionally I’ll get an email from a client requesting if I can ‘throw something up on the[ir] website.’ I’ve had good laughs with co-workers and colleagues in the past about this, because this question is ultimately very

Posted in: Development  |   |  Leave a comment

The Stupid Zip Archive and WordPress Duplicator Issue

I’ve run into this issue a couple times and had to set everything aside and figure it out. It didn’t take long. I use WordPress Duplicator often to, well, duplicate and move different WordPress sites from production, for example, to

Posted in: Development  |  Tagged with: , , , , ,  |  Leave a comment