My Lazy Loader plugin needs PHP 5.3 or higher. If users count on that, it is annoying if this minimum version is raised through a inadvertency (like using the
 array syntax) in a patch or minor release. Continue reading Check for compatibility with specific PHP version using Travis CI
This week, Gutenberg 3.0 was released. With that, it is possible to specify blocks as child blocks of other blocks, so they only will be visible in the block inserter when the parent block is selected. Continue reading WordPress weekly recap #23: Gutenberg 3.0 and more
Currently, I want to wrap all acronyms – »PHP«, for example – in a
span element to display them as small capitals. So I searched for a way to search and replace in MySQL, and there it is:
For example, the following command wraps
WOFF in the post titles in the wanted markup (it is a good idea to create a backup before):
UPDATE `wp_posts` SET `post_title` = REGEXP_REPLACE(post_title COLLATE utf8mb4_bin, 'WOFF', '<span class="smcp">WOFF</span>' ) WHERE `ID` = 4691
The first param of
REGEXP_REPLACE is the string to search in – we set the column’s name we want to search in. The second parameter is the searched string and the third the string to replace the searched string with. Setting
COLLATE utf8mb4_bin (you may need to adjust the collation if you use another one) is important because otherwise, the search would be case insensitive.
Like written in the MariaDB documentation (and as the name suggests) you can also use regular expressions with
REGEXP_REPLACE. For my German version of the weekly recap, I used the following:
UPDATE `wp_posts` SET `post_title` = REGEXP_REPLACE(post_title COLLATE utf8mb4_bin, 'KW([0-9]+)', '<span class="smcp">KW</span>\\1' ) WHERE `ID` = 4691
\\1 inserts the part inside the brackets from the searched string into the replace string: the week number.
Because of the larger amount of new code in 4.9.6, the team decided to disable the automatic updates for a day to wait for incoming issues. There were some issues with plugins that use the wrong hook for the new privacy features that caused a white screen, so the team kept the feature disabled. Continue reading WordPress weekly recap #22: no auto updates for 4.9.6 and more
Recently I needed to improve the performance of a WooCommerce installation with multiple 10,000 products. On regular WordPress pages, performance was already good – the performance issues occurred on product archive pages. The post »What does it take to scale WooCommerce?« by Chris Lema contained the tip to use Elasticsearch, that can be integrated via ElasticPress that also supports WooCommerce. After that, WordPress uses Elasticsearch instead of the MySQL database for querying content.
Read and tested, and the result: a significant improvement of load time, now below one second ⚡
So if you are having issues with load speed on larger installations, where the database seems to be the bottleneck, try using Elasticsearch 🙂
This week WordPress 4.9.6 was released, which comes with several privacy tools. Continue reading WordPress weekly recap #20: WordPress 4.9.6 and more
You likely heard from it: GDPR is just around the corner. In this context, it is a good idea (it would have been a good idea before too, but one (at least me) did not think about it so much before…) to limit requests for external resources – and with that the sending of the user’s IP address to the other server – to the absolutely essential.
The emoji fallback for older browsers and Gravatar images are two often-active WordPress features that make requests to external servers. Now one could say, okay, then I disable them, but there are other ways. Here I present two plugins, which should be at least more harmless from a data protection point of view than the built-in solutions of WordPress (but, of course, I am not a lawyer). Continue reading Loading Gravatars and emoji fallbacks from your own server for WordPress sites
The 4.9.6 release is planned for May 17 now – the first release candidate was published on May 10. Continue reading WordPress weekly recap #19: 4.9.6 schedule changes and more
The ElasticPress plugin allows connecting to an Elasticsearch server, for example, to show the results of WordPress search sorted by relevance. Besides that, the plugin comes with a few additional features, one of them Autosuggest. That displays results while the user is typing his search into the search field. This post shows you how to use that feature on Apache without having access to the
httpd.conf file. Continue reading Autosuggest for WordPress search with ElasticPress on Apache