Archive | Snippets RSS feed for this section

Speed up WordPress when you have a lot of terms

The autosuggest procedure can slow down your WordPress wp-admin interface quite a lot when you have a huge amount of terms. Sometimes it’s useful to just disable this feature to make wp-admin more responsive. You can do this by adding the following to your functions.php file

Continue reading

WordPress Importer with remote lookup for assets.

Due to the lack of remote connectivity I did a small patch to the WordPress importer (v 0.61) that allows us to place the files locally and bypass the remote fetch the importer would usually attempt. As I ran into this problem very frequently I think that might be useful for others as well. In […]

Continue reading

Cache posts in category/tag/taxonomy for better performing content blocks

If you ever needed to grab a bunch of posts from different categories or taxonomies into your theme to fill certain layout blocks with their respective content you’d likely ended up doing a bunch of WP_Query calls with the desired parameters. That’s all nice and works ok, but it causes some additional database queries for […]

Continue reading

Filter arrays of data by any field in the array/objects

I frequently need to grab a subset of data from an array. I just stumbled over the FilterIterator which provides a nice interface to do just this. Based on this class here is a implementation which lets you perform basic filtering. Here is an example: And here is the class that makes it happen.

Continue reading

Minimalistic progress bar for CLI based PHP scripts

I’m doing some CLI scripting here and there and as I’m still on the way to implement it the right way using a framework like wpcli, wpshell or the like for my scripts I sometimes like to put a little progress bar in my scripts to see how things are going and how much longer […]

Continue reading