Published
Updated

WP-CLI is a great tool which we use heavily at Seravo and if you are a developer we hope you do too. Version 2.3 is a smaller release but with some nifty improvements and we actually also participated with a contribution to make comparisons between cross-platform wp i18n makepot creations much better.

New command ‘media fix-orientation’

Maybe you have noticed that images that look OK on your camera or smartphone don’t have the correct orientation when uploaded to WordPress. This is because the orientation is set as EXIF data which is not being respected when uploaded to WordPress. Of course, this is something that would be nice to have solved in the WordPress core and there is in fact a 9-year-old Trac ticket that is being worked on. Until this is solved there is now a new command media fix-orientation that reads these special tags and properly applies them to your images.

Wildcard support to `–skip-tables` parameter

The command search-replace is probably a command you use quite often, and it now has a new additional feature. The flag --skip-tables can now use wildcards to skip a group of tables which can be useful for example when you want to skip tables of a plugin that begin with a prefix. 

Better comparisons with ‘wp i18n makepot

We develop and maintain our own sites at Seravo. An issue was created on July 12th in one of our private GitHub repositories with the title “Investigate why .pot file generation makes ugly diffs”. It had been noticed that commits of updated pot and po files – file formats that are very familiar to anyone that has done some WordPress localization – resulted in very ugly diffs, even after very small changes. This made it difficult to overview changes to these files and therefore very difficult for anyone to review any of these changes.

An example of a “ugly” diff, even if it was not many actual changes the diff was too large to be shown by default by GitHub.

After some investigation it became clear that the reason for this is that the command wp i18n makepot relies on the order the files are returned by the filesystem, and different filesystem implementations on the different operating systems of developers return the files in an arbitrary order.

My colleague Leo set up an issue about this in the WP-CLI repository and later also provided a pull request including the relatively small change to solve the issue with an accompanied test that verified the implementation. Within a couple of weeks, it went from an issue in our internal GitHub repo to a merged pull request and a part of the v2.3 release – a great example of how open source should work.

Continue reading

To catch up on all changes go read the full WP-CLI 2.3 release post and as always the WP CLI documentation is a great resource to learn more about all available commands.

Available for all Seravo customers

We have already started rolling out this to all our customers and the new version is, of course, the default on all new installs. If you are curious about other developer tools that are available, please read more from our WordPress Developer Documentation.