WordPress sites have a lot of media files, and over time we are just uploading more and more media which get bigger as we demand more quality and higher resolutions for pictures being displayed on super ultra definition high dpi mega screens. This makes for great web browsing experiences, but poor developer local environment experiences! :(

However when a developer needs to clone this site locally we now have some decisions to make. We can just deal with the media not existing locally, or copy the entire media library down to our local machines. I like to test sites accurately, but I also don't want to have to copy all your pictures and waste hard drive space!

A few years ago I shared this Gist, which mass redirected all media back to the live site. Rejoice! Your local hard drive space was spared and your local WordPress environments looked like production thanks to loading the original media files! There was one problem though, now when you tried to upload files locally the file existed locally and was still redirected to production. Leaving you with more broken images.

No more.

With the latest iteration of my Nginx redirect for WordPress media libraries, you can redirect missing files to production, and keep uploading files locally without breaking them.

Just drop this little snippet into your site's Nginx configuration, and update the production site's URL.

I'm sure there are ways to make this more elegant than it is now, I am not a Nginx configuration expert. However this is not built for scale or performance, this is built for our local development environments. So, things like "if statements are bad for Nginx" don't bother me.

This post is simply my attempt at testing out the code blocks of Koenig, the new block/card based editor for Ghost. Hope you enjoyed it!

]]>

Yesterday in the #ecommerce channel of the Post Status Slack there was a conversation around the moving of WooCommerce orders and other data out of the wp_posts table of WordPress. This is (and rightly so) a hot topic of sorts within WooCommerce right now because of the impact it

Yesterday in the #ecommerce channel of the Post Status Slack there was a conversation around the moving of WooCommerce orders and other data out of the wp_posts table of WordPress. This is (and rightly so) a hot topic of sorts within WooCommerce right now because of the impact it will have to the entire ecosystem.

One small annoyance for me is when claims about how large WooCommerce sites are slow, which I can understand where this comes from but also disagree when someone believes this is always true and unavoidable. So I thought a sort of brain dump from some of the experiences I've had with WC at scale and avoiding slowness could be useful.

I can say with a fair amount of certainty that the size of the database is not the reason the site is slow. This isn't to say that scale and speed is not related because they absolutely are. The larger the site gets, the more important it is that the people building the site are taking care to ensure that performance is being considered in all aspects of the site, even when it means the core of WooCommerce is at fault.

One good example here is post meta, by default the meta_value of post meta is not indexed. This impacts nearly every area of the site, a few examples:

Product searches on the front end of the site, because you wanted customers to be able to search by the attributes, SKU, or other meta data of a product

Order searches in the back end of the site, because you want to be able to look up orders based on the customers email address or other order meta data

Customer My Account page, because orders are associated to customers in post meta, the only way to build this page out of the box is by querying against the post meta table on a non indexed column

These are three areas of the site that are likely used daily by customers and store owners in a WooCommerce site and create slowness because of the way they are built, and in turn create the impression that a large site is a slow site.

For context, my work at ColourPop we scaled WooCommerce to a point where our MySQL database was over 100GB in size, with just under 200,000,000 rows of post meta (194,596,005 to be exact). This site also on average loaded in 1-2 seconds from the server. New Relic's application response time generally reported around 1.2 seconds in average traffic situations, 1.5-2.5 seconds when traffic sustained 2-5x normal load.

Even in low or normal traffic situations product searches became slower, order searches became un-usable, the my account page was extremely slow and could actually crash the site in very high traffic situations. In all three cases yes, scale created a scenario where WooCommerce was slow, but at the same time all three are avoidable. Product searches could be run through elastic search creating a blazing fast search that also reduces the load on your MySQL database increasing stability. Order searches requires more work and depends on your specific processes but can also be modified to use more efficient methods of finding your customers orders. The My Account page we took from taking 20-30s for an average customer, to less than 5 seconds when loading 300 orders. We did this by creating a helper table index of sorts that was a drop in replacement for the My Account page. After implementing this, we never saw a slow trace in New Relic from the My Account page in normal site conditions again.

All together, the above solutions were less than 10 hours of work. Now that everything is already figured out, it's even less than that to implement. Improving the search of core WordPress is a matter of installing a plugin or connecting to a third party service, order search you can use the woocommerce_shop_order_search_fields filter to choose which fields are being searched, and an older version of our index plugin can be found on GitHub.

Your site is what makes your site slow.

It sounds like a joke, but more than the hardware powering your site, or the size of your database, or the version of PHP you are running, the software and architecture choices you make in your site will make or break your performance. You can in fact take a large WooCommerce store and make it run faster than the average WooCommerce users site - I've done it. :)

]]>

While I haven't been hiding this news, I haven't really announced it either.

I've recently joined Mindsize as a Partner, where I will be focusing on development and products.We help brands sell online with beautifully designed, performance tuned eCommerce websites.

While I haven't been hiding this news, I haven't really announced it either.

I've recently joined Mindsize as a Partner, where I will be focusing on development and products.We help brands sell online with beautifully designed, performance tuned eCommerce websites.

I'll post more on this later, for the time being this also does not impact my work at ColourPop. It will however open many new doors and take my solo freelancing to the next level. We all round each other out in areas we each are not as passionate about (or skilled), for me personally this means where I can excel and continue to grow in enterprise development and building products, I don't have to worry about design or user testing.

I can't imagine a more exciting time, and look forward to everything that comes from this new partnership.

]]>

Cassie and I have for a while now been wanting to move out of Illinois, but for various reasons have stayed put here in Peoria. We’ve been pretty fortunate the past few years, which has put us in a pretty good position for finally moving. For us, it is

Cassie and I have for a while now been wanting to move out of Illinois, but for various reasons have stayed put here in Peoria. We’ve been pretty fortunate the past few years, which has put us in a pretty good position for finally moving. For us, it is obvious why Texas is the best choice but seeing as we do get asked pretty regularly “Why Texas” – it seems like a good reason for a blog post.

So to start with, some of the bigger reasons we are moving from Peoria. These are not the only reasons, there are a lot of reasons that built up to the desire to move, but these stand out especially.

Technology

Peoria is not so great for technology. People are trying, sure, but my own personal opinion is that while there are some very passionate people here who I would love to see succeed in making Peoria a more tech savvy place, I think the rest of Peoria simply does not care.

Travel

Maybe it is just me, but having an international airport that has zero international flights, and services nothing but regional planes that I do not fit in comfortably, is kind of sad. In the past few years I’ve flown around a bit more both for personal and business reasons, and fully expect this trend to continue upwards. Even to take a train I have to drive an hour away.

We do enjoy traveling around, and would like to continue to enjoy traveling. Unfortunately a lot of small things all build up into a larger issue of it is hard to travel from Peoria.

The Cold

I don’t care for the cold. Neither does Cassie. It’s not terrible, but it’s not enjoyable. Some people prefer cold over heat, but personally I can tolerate heat better than cold. Not to mention you don’t have to shovel heat out of your driveway after an extra hot day.

So, why Texas?

It was pretty easy to decide on Texas, pretty obvious to be honest. Imagine being untethered and having the ability to move anywhere you chose, then just funnel down the options from there.

We don’t plan to move to a new country, so we’re still in the United States, going further, we are sticking to the contiguous 48 states.

We are trying to find warmer weather, so we’re looking at the lower half the country.

I am ok with heat, but don’t enjoy humidity so much. So not the south-east.

Not California.

If you’re following along with your map up to this point all that is left is from the edge of California to the edge of the south-east. Really at this point it is a no brainer because who would enjoy living in a desert? Texas is the only good state to live in.

So, where in Texas?

Knowing that we are looking for easy travel and technology, that focuses our search to bigger cities in Texas. We removed Houston early on because it is still pretty close to the south-east, and that leaves Austin, San Antonio, and Dallas-Fort Worth.

At the end of the day of those three choices, we chose Dallas-Fort Worth. The combination of easy travel and the very tolerable winters and summers were major factors.

So, when?

Relocating like this it is a gamble with both buying and renting. On one hand renting is less risk, but at the same time houses in DFW keep getting more and more expensive. In some cases over $100,000 more in just a few years. We could buy a house and it could either continue to increase in value (win) or it could lose value. We’re betting on the housing market to continue to rise.

This will be our first home we buy, so not only are we relocating to a totally new state, we are getting our first mortgage at the same time. This has been a long process so far but we are finally to the point we are starting to look more seriously at houses, and could make a serious offer.

This means we could be moving in a month, could be a few months. It all depends on when the right house shows up for us.

I’ve got my DFW belt buckle ready to go, DFW here we come.

PS: Texas has some great BBQ. Of all the BBQ, my favorite BBQ is Texas BBQ.

#BBQ

]]>

Unfortunately, I was not able to make it to the first WooConf, but the next one is coming around the corner! Better yet, I will be there to talk about makeup scaling WooCommerce. I look forward to sharing my thoughts, experiences, and a bit of how we’ve been able

Unfortunately, I was not able to make it to the first WooConf, but the next one is coming around the corner! Better yet, I will be there to talk about makeup scaling WooCommerce. I look forward to sharing my thoughts, experiences, and a bit of how we’ve been able to do what some claim cannot be done with WooCommerce.

I know some people have been considering NOT going to WooConf, and some are on the fence. So I’ve put together a quick list of a few top reasons to go. This is just what came to mind right away, there are tons more reasons to go, and this list may or may not be in a specific order.

I am speaking

Austin has some really great BBQ, and tacos.

You are going to learn a ton, not just devvy nonsense from developers like myself but a lot of great topics from some amazing speakers. Take a look at the speaker list and see for yourself.

Networking. Chances are if there is anything you are looking to do with your business related to WooCommerce or your website, someone at WooConf that you could talk to about it.

It’s not in San Francisco, so you don’t have to give up your first born child to go.

So I know I will be at WooConf this year, will you?

]]>

Whenever someone is launching a website ususally they want to be able to know how many people are visiting it, what pages they are visiting, and where those visitors are coming from. Almos always the default answer to this is Google Analytics. Which is this insanely powerful analytics platform that

Whenever someone is launching a website ususally they want to be able to know how many people are visiting it, what pages they are visiting, and where those visitors are coming from. Almos always the default answer to this is Google Analytics. Which is this insanely powerful analytics platform that can give you insights into just about every part of your website. For free.

Whenever something is very powerful, it tends to also get complex. So when Joe Site Owner wants to know “how many people visited my site today” there are some cases where this can be a hard number to get out of Google Analytics for those unfarmilar. I won’t even mention all the other seemingly basic pieces of data that require long paths of clicks just to get to the basic report, then having to drill down. Don’t get me wrong, Google Analytics totally has it’s place and for some sites it is totally worth it, on many though it is just overkill.

So, what now? Without the one go to analytics platform used by nearly everyone for almost everything, what do you use?

Personally – I use Gaug.es for sites where I do not need more advanced and complex analytics. They were previously a product owned by GitHub, if you need some validation before looking closer at them. Take a look at the screenshot below, it would be hard to create a simpler interface. An interface where you can login, and just get the data you are wanting right away.

Then it has some more advanced tools which are really useful for developers. Screen sizes is fairly self explainatory, a breakdown of the resolutions of screens of your visitors. With this you can get a quick idea of how important say a responsive site would be to your visitors.

Technology is a bit cooler. To start with you can get a breakdown of the browsers and operating systems that your visitors are using, but it takes things one step further. You can at a glance see how many of your visitors browsers support various web technologies. I quickly know that if I wanted to use the canvas element on this site, it would be a safe move. However many visitors would have a hard time with the datalist element.

I’ve been using Gaug.es for quite some time now and have really enjoyed the simplicity of it. I’m not missing anything I would have wanted from Google Analytics for things like my personal blog, and I can check my analytics quite a bit faster too.

If you are using something other than Google Analytics for analytics, leave a comment below with what you are using.

]]>

Cross sells… Upsells… What are they? What’s the differece? Why does it matter?

What are they?

The short version: Recommendations of additional products to purchased based on what you are looking at or about to purchase. An upsell being something better than what you have (a newer or better

Cross sells… Upsells… What are they? What’s the differece? Why does it matter?

What are they?

The short version: Recommendations of additional products to purchased based on what you are looking at or about to purchase. An upsell being something better than what you have (a newer or better model… an upgrade), while a cross sell is something in addition or an accesory that goes with the product. You can find more about this on Chris Lema’s great post about upsells and cross sells.

Why does the difference matter?

To start with recommendations and how you display them may not make much of a difference to a store. So say you start adding them just in either the cross sells or upsells depending on how you feel that day. Then your store gets bigger. Now you have hundreds of products. You realize that you want to start focusing your upsells and cross sells a bit better and see the mess in front of you. Now you will need to manually edit every product and put upsells and cross sells into their rightful place.

Converting Upsells to Cross Sells via MySQL

Having recently cleaned up this exact scenario using MySQL I thought I would share the queries I wrote to do this. My goal:

Convert all current upsells (that are not empty) to cross sells.

Before continuing please make a backup of your database.

To get a lay of the land, I decided to see what I was working with. This first select query will pull all the existing cross sells, and the matching upsell, where the upsell is not an empty set.

For me these results showed I had an empty cross sell for every single upsell. This makes life a bit easier, because I do not need to worry about overwriting my cross sells with up sells. However if I had run into a case like this, my next query I would have limited to update only cross sells that were empty as well.

This update query is a bit more advanced than just a standard select but mostly straight forward. On products which have upsells, copy that upsell data into the cross sells.

Success, we have copied our up sells to cross sells. Now, we have duplicate data. Our upsells and our cross sells are the same. Personally I do not like to make wide sweeping changes all at once, so I take baby steps. For how I work, I can take a step, check the results, double check the results, and then move to the next step. In my experience I’ve found if something ultimately does not work as expected it is easier to revert (outside of going and restoring a backup).

The process to empty all the upsells is even easier. Where the upsells are not empty, update it to an empty set!

So in WooCommerce (as of 2.3.x) every use of a coupon means another post meta is added to that coupon with the key _used_by. For sites that offer a single coupon for all of the general public to use, this can cause some issues in extreme edge

So in WooCommerce (as of 2.3.x) every use of a coupon means another post meta is added to that coupon with the key _used_by. For sites that offer a single coupon for all of the general public to use, this can cause some issues in extreme edge cases. In our specific case we ran into an issue where the meta of a single coupon totaled 78.5k rows (at the time the post meta table included over 15,000,000 rows). At random without any changes to the site code or server configurations the site immediately started having degraded performance.

After a large effort on our end and the L3 support at WPEngine, they were able to trace back the performance to a looping of queries to the wp_postmeta table but were not sure why. It was tracked back to this line of code within WooCommerce.

get_post_meta ultimately down the line trigger update_meta_cache to be called. The SQL query to pull post meta does not include the meta_key, because WordPress is built in a way that it will attempt to instead just make a single SQL query and cache the entire result. So when you call get_post_meta multiple times in a row for a single post, only one SQL query is actually triggered. At WebDevStudios, Brian Richards and I actually used this to our advantage after some discussion on the best way to store data on a project.

In almost any other use case the use of a single SQL query to pull all post meta and cache it works perfectly fine.

However, if you are using Memcache as an object cache you should know that any single piece of data stored by default has a maximum of 1MB in size. Our post meta for this single coupon just hit that 1MB limit and was not cacheable by Memcache anymore.

So, when WC_Coupon->populate() loops through all the meta keys of the coupon calling get_post_meta on each to populate the object, instead of one SQL query for everything it hits the database for every single call. This caused quite a bit more stress on the database causing response times to go from 10–25ms to nearly 200ms, per query, with nearly 15 queries for this specific coupon as well.

Over the past few years there has been a growth of companies using the “plugins as a platform” type model. They will offer up their core plugin for free, and then monetize it with paid extensions. WooCommerce is the most notable in this market, but there are others. Easy Digital

Over the past few years there has been a growth of companies using the “plugins as a platform” type model. They will offer up their core plugin for free, and then monetize it with paid extensions. WooCommerce is the most notable in this market, but there are others. Easy Digital Downloads and Ninja Forms are two plugins that also do this that I use quite a bit.

Disclaimer: I have developed a number of extensions (free & paid, public & private) for a number of platforms – including all the ones listed today.

The Good.

For the user, this is (usually) a really great thing. They get their core functionality for free and then just pay for the features they need. If they want to add a recurring subscription to their shop later, they just buy that extension and drop it in. Hard to beat the simplicity of that isn’t it?

There are always haters and of course this feels like nickle and diming when you end up “needing” (read: wanting) a lot of features on your site. Honestly – that’s all I chalk that up to as long as the extensions are reasonably priced. Don’t want to pay for $500 in extensions that build 90% of your site without having to hire a developer? I can understand being cash strapped when getting started but please at least respect the amount of development that has gone into all the plugins you are using. Chances are if you had to build that site from scratch you are looking at a 5–6 figure estimate. How’s that $500 in plugins sounding now? 🙂

The Bad.

For all the plugins as a platform type marketplaces out there, I don’t think there are any that do not have third party developers buiding the extensions. Next time you go to buy an extension look around for a “Developer” name listed on it. It may or may not be the company you think you are buying an extension from. This is not by itself an entirely bad thing… there are some amazing developers out there and they do not have to work for the core plugin to be amazing. I am not including this fact as something that is “bad” in itself, it can actually be great. It is something to be aware of though and is not always totally clear to the uninformed.

What this can lead to though is a semi-political environment and a number of “got there first” situation. The reason for this is obviously the best place to sell your extension is on the website of the plugin itself, you get the most exposure and the best sales there. To avoid confusion these sites are not going to sell two extensions that do the same thing. So usually regardless of quality or what is “better” (of course that is totally relative). Unless something really messes up or breaks if someone else has built an extension, you need to find somewhere else to sell it.

The typical extension marketplace uses Trello as a place to manage all the extensions. Usually “claiming” an extension is a matter of creating a card and assigning your name to it. At that point unless you take too long to build it or are unresponsive someone else cannot just come in and build the same thing and have theirs sold in place of yours… again regardless of quality.

In all cases of selling extensions on the core plugin’s website all of the code is in initially audited and held to certain standards. This does not include the likes of CodeCanyon or other marketplaces where you can just upload whatever and good or bad it can likely sell.

The takeaway here is, just because you are buying from “the people who made the core plugin” that does not mean you are getting the same developers for your new extension. Sometimes you do, sometimes you don’t, just be sure you know what you are buying.

The Ugly.

It’s hard to find a nice way to say this next piece.

Some extensions are total garbage.

As an average consumer the typical extension purchase involves reading the title and description and if it sounds like it does what they want they may get it. Sometimes this invovles looking at documentaiton, watching videos, reading reviews.

Having been in that mindset and knowing a number of developers who build extensions I see varying levels of though put into the code. You have the ones that want to build the best product and it becomes very obvious. There are others who want to find the extension that they can do the least work on and it sell high volumes.

The good news here is usually with larger marketplaces there is some sort of refund policy. If shortly after you buy an extension it turns out to be horrible you can possibly get a refund. Smaller shops seem to do this much less.

The ugly part of this is, usually the consumer buying an extensions does not know what good or bad code is. They usually do not find out there is an issue until they have issues or the site gets large enough that they work with a developer to further grow their site, and these extensions start creating limitations and more issues than they are worth.

My Point.

For small projects or something you just need to get off the ground, an extension can be great. If you have plans to really grow a site and you want to make the most of your time and money investment into a site… work with a developer to plan that out and decide what features of yours can be accomplished with a trusted extension, and what features you want specific enough functionality that it makes more sense to develop your own from scratch.

The last thing you want to do is become succesfull and find out your site is getting in your way of your success. Dealing with growth pains of rapid success can be hard enough, you really don’t want to also end up having to rebuild half your site at the same time!

]]>

There are times where as a developer you run into that stupid little one line issue on a project that you wish was different but you simply cannot be bothered to go through the trouble of creating a pull request on GitHub. I ran into this often before, maybe I

There are times where as a developer you run into that stupid little one line issue on a project that you wish was different but you simply cannot be bothered to go through the trouble of creating a pull request on GitHub. I ran into this often before, maybe I could have been more willing to spend time on offering code to others, but really I just didn’t feel like having to fork and clone and make changes and then submit the PR.

This is old news but a while back GitHub made these things so much easier to deal with. If you are browsing a project you do not have commit access to (or even if you do) and you edit a file right from the GitHub website… you can now create a PR. This is pretty ingenius and I can only imagine has increased the number of contributions from those who know it exists.

Now when I run into little things that can be changed like this… I just submit a PR right from the website. While it seems bad form to strat throwing changes at projects that are completely untested at times… it still has it’s place.

These are not groundbreaking new changes, but I feel like they make a difference.

So thanks GitHub, for making it easier for me (and others) make just a little bit more of a difference in the world.

]]>

About a year ago I was searching around for how to best implement Redis into WordPress and did not come up with much. There were a few blog posts around the internet from a few developers who got it working but I never did replicate their success. After watching Mark

About a year ago I was searching around for how to best implement Redis into WordPress and did not come up with much. There were a few blog posts around the internet from a few developers who got it working but I never did replicate their success. After watching Mark Jaquith’s WordCamp Europe talk about scaling WordPress I decided it was time to take another crack at it. I was amazed at what I saw on the first try.

If you have been involved in any website that has needed any sort of scaling or major caching, you have probably heard of Memcache. There are a lot of people who will swear by Memcache, and Memcache was at one time probably really really great. However just like the web has shifted radically in the past few years from the Apache being the standard web server, I believe Redis is going to become the standard for caching. Redis is as lightning fast key/value data store, and when I say lightning fast I mean insanely fast and super easy to setup.

I don’t mean to sound fanboy-ish, but when I find something that works and works WELL I am happy. The first time I setup Memcache it actually slowed down the site. It was more overhead than it was worth and was a real pain in the ass to setup (note: this was on 2x 1GB Linodes at the time, Nginx/PHP on one and MySQL/Memcache on the other). I came to the conclusion, though I may be wrong on this, that Memcache was going to be great… for a site that had enough traffic to make it worth while. Redis on the other hand takes me about 5 minutes to configure on my websites and even speeds up low traffic sites. I’ve now setup Redis on about 5 production websites, and a dozen or so development sites. Each time it is extremely simple and load times always drop.

So how do I setup WordPress with Redis

All of my servers run Ubuntu 14.04, with Nginx & PHP5-FPM. On Ubuntu Redis is extremely easy to install, it is just one apt-get command away.

apt-get install redis-server

This will install and setup Redis locally without much work on your end. To get a slight edge out of Redis, and because I have no need for persistent data, I have been disabling saving the key/value data in Redis to disk. To do this open the /etc/redis/redis.conf file and about 3/4 the way down comment out the “save” lines. Redis will save the data to disk every X seconds at the intervals in the config. Since we are disabling saving to the disk this is slightly less work the server is doing and in theory gives you that much of an edge.

Next install the object-cache.php file into WordPress. There are a few version of a Redis object-cache.php file floating around, the version I use is the one provided by Pantheon on WordPress.org. Simply download this plugin, and upload the object-cache.php file into the root of your wp-content folder. This is not your normal plugin, and should not be installed like a normal plugin – it will not work. This is what WordPress calls a “drop-in” – meaning, WordPress will look to see if this file exists in a very specific location and if it does override some of the core functionality of WordPress with it. In this case we are replacing the core WordPress object cache with Redis. The core WordPress object cache will only persist through a single page load and then disappear. This doesn’t help much when you have multiple users all hitting the same page if that cache doesn’t persist to the next page load. This is why we want to save that cached data into Redis and not the servers memory. This way on the next page reload the queries (assuming they are unchanged) will be able to just pull data from Redis instead of waiting for MySQL to go perform a query and return data.

Why should I care about caching? I am only saving milliseconds.

Your results may vary, some sites I saw savings in multiple full seconds, others I only saved 50ms or so. This may seem negligible, but I believe optimizations come in baby steps. There are very few changes you can make on a properly setup server with a properly coded website that will give you amazing speed boosts. Your optimizations may only save you 20-200ms at times, BUT if you keep chipping away at the load time 10x 20-200ms will soon be 200-2000ms. Give it time, and if you did it right, speed will come.

]]>

Recently I activated Jetpack Comments on a site that also had WooCommerce and this completely broke the reviews system because of course Jetpack wanted to do it’s job and replace the comments with it’s own.

After Googling around and checking WordPress.org there were not many resources available

Recently I activated Jetpack Comments on a site that also had WooCommerce and this completely broke the reviews system because of course Jetpack wanted to do it’s job and replace the comments with it’s own.

After Googling around and checking WordPress.org there were not many resources available showing how to fix this. I did find one reply in a WordPress.org forum thread showing how to fix this. So thanks to cam5 on GitHub we have this handy code to toss into the top of the single-product-reviews.php WooCommerce template file which fixes everything!

I did a quick check for an action this could be tied to instead of having to use a custom template file but did not find anything right away.

]]>

Ever let your WordPress users database get a bit out of control? If you do not allow user registration but have too many users that have no posts or reason to be on your site here is a quick SQL query to clear those users out of your database. Yes

Ever let your WordPress users database get a bit out of control? If you do not allow user registration but have too many users that have no posts or reason to be on your site here is a quick SQL query to clear those users out of your database. Yes you could probably just delete them from the dashboard, and yes this is a pretty rare use case… but I needed this just now so I’m sharing it!

Make a backup of your database before you read any further. I am not responsible if you delete your users and cannot bring them back. You’ve been warned.

First delete the users, where the wp_users.ID is not found in the wp_posts.post_author column. We use distinct here because a single user ID could be the author of 1000 posts, and be returned 1000 times when we only need it once.

delete from wp_users where wp_users.ID not in (select distinct(post_author) from wp_posts);

Think your done? Look in your wp_usermeta table!

Now we delete all the wp_usermeta entries where the wp_usermeta.user_id is not found in the wp_users.ID column. Similair to the last query but just pointing at different tables and removing the distinct since the ID column is already all unique values.

delete from wp_usermeta where wp_usermeta.user_id not in (select ID from wp_users);

]]>

I can’t say I know where this started or why it started but it seems the hosting industry for the most part has taken SSL certificates and the lack of a customers education on the market and turned it into high profit margins.

I can’t say I know where this started or why it started but it seems the hosting industry for the most part has taken SSL certificates and the lack of a customers education on the market and turned it into high profit margins.

It may look like I am picking on WPEngine here but I am not. They just happen to recently start offering SSL certificates. Since I am positive WPEngine cares about their customers much more than I am OK with calling them out a bit 🙂

Many other hosts do the same exact thing, reselling SSL certificates for many times what they actually pay for it while at the same time in most cases the entire process is automated. The goal of this post is simply to push the average user to take a bit of time to learn about SSL and become an informed consumer, and maybe save a few bucks in the process.

WPEngine now offers SSL Certificates

WPEngine is a fairly well known WordPress host. They can scale your sites in a way that most average WordPress users cannot even imagine. They also just announced a week ago that they offer SSL certificates now! This is great for customers because the process before of getting SSL setup may have been a bit daunting trying to figure out their CSR’s and getting the keys and validating their domain. For some this is amazingly easy, for the average WordPress user CSR is just another acronym they do not care to know. This potentially complex process is now just a few clicks away! Awesome right?!

So whats the difference?

The difference is you have to do a little more work for your NameCheap certificate. Not that it is a hard process:

Generate your CSR and upload it to NameCheap. I use a little wizard that gives me some text I can paste rigt into my terminal.

Validate your email by clicking a link that gets emailed to you.

Download your SSL certificate files and send them to WPEngine in a support ticket.

All together this is maybe 5 minutes of copy/pasting/waiting for an email/sending a ticket work. When I can save a few bucks by doing something myself I’m all for it, especially when 5 minutes can save me $40.

But you are willing to spend $40 to not have to spend maybe an hour to learn how to do this?

Sure! More power to you and WPEngine will of course take care of you. There is absolutely nothing wrong with buying your SSL certificate from WPEngine or any other host. Let me show you a little basic math here though.

Say you run three sites, and two of them need SSL certificates. You do not want to buy the certificates for long term just yet so you are going to renew it annually. Let’s see the cost difference over the course of three years.

A direct cost savings of $234.20. Now say you value your time at anywhere from $50-$100 an hour. Subtract the value of one hour of your time from that savings, are you still in the green? Do you run multiple sites that you want to setup SSL for? Then maybe it is time to sit down for an hour and learn the basics of SSL and save yourself a little bit of money.

Now imagine you run an agency and you have 20 sites you host on WPEngine that require SSL. Are you ready to save $800?

All that said, there are much worse hosts to buy SSL certificates from. There maybe one host out there that sponsors a NASCAR driver that went out and made themselves a certificate signing authority and branded their own certificates and charges the same $50 price for them while still making you do all the work.

PS: Sorry WPEngine! 🙂

]]>

Some shops just do not have many products, or want to list all the products availble on a single page. Out of the box WooCommerce will paginate your products. Maybe you want to list all your products on one page though?

Some shops just do not have many products, or want to list all the products availble on a single page. Out of the box WooCommerce will paginate your products. Maybe you want to list all your products on one page though?

The easiest way to do this is with a one line filter, the documentation even explains this. However at first glance you would think you need to put some large number in to make sure you never hit that per page limit. If you are familiar with the WP_Query pagination parameters though, you will know that -1 will return ALL results without pagination.

Combine that knowledge with the filter in the WooCommerce documentation and you have a proper filter to display all your products at once!

Just add this line to your theme’s functions.php file for it to start working.