Blog

One-click WordPress Login With MetaMask

In this tutorial I will show you how you can add “Login with MetaMask” button to your WordPress login page. Once you click on it, you will signed in to WordPress dashboard. Here is how it is going to work:

Login flow with MetaMask for WordPress
It is pretty much how it is going to work. The only thing, once you’ve already connected MetaMask there are going to be less steps – just “Signature request” modal window, that’s all.

How to Create a Shared Media Library in Multisite Network

Every once in a while I am receiving questions about my Simple Multisite Crossposting plugin whether it works with shared media library plugins or not (yes – it works). And when I decided to test it I figured it out that there are multiple shared media library plugins out there and every one of them works a little bit differently.

The key idea of most of these plugins is to store all the media on one “main” blog and not necessarily it should be the blog with ID = 1. Then some of them use switch_to_blog() function every time you’re working with attachments on subsites, the other ones even create attachments in database linked to original files on all subsites (I assume it could lead to issues by the way).

Most of all I like a switch_to_blog() approach because it seems unharmful, you can even stop using network media library any time, just deactivate the plugin and continue to use your websites as usual.

How to Add CSS to Block Editor Based on Post Type

I have multiple post types on my website, for example you’re reading a normal post, but there are also support articles like this one. The posts are almost similar except one thing – the heading font size.

It is quite easy to change the title font size depending on a post type on a website, you just have to make sure that your theme is using body_class() function and then you can use a CSS selector like .single-{post type} h1, but this way will never work in Gutenberg! So please don’t try to add classes via admin_body_class or anything like this.

WooCommerce REST API: Create Product with Images

I am starting to have more and more tutorials about REST API on my blog which is for sure because I am doing some work with my crossposting plugin.

Today is another one where I am going to share with you a simple code example how you can add Product image and Product gallery images when creating a product with REST API.

Just in case I mean these things:

WooCommerce product image and gallery images
You can find this if you go and edit any WooCommerce product.

Compare Meta Box Plugins Performance

Even though Gutenberg (WordPress Block Editor) has become our new reality and FSE themes are also on their way, we still need meta boxes on our projects. The meta boxes aren’t necessarily classic meta boxes for posts, it could be additional settings fields for taxonomies, users, comments and even options pages. It means that we are going to need them for a very long time. Maybe even forever.

Of course the best way to create any of the mentioned above is to code by yourself. But it could be really time consuming especially if you have a lot of fields (and working on lots of projects).

That’s when metabox plugins come into play. The most popular ones are Advanced Custom Fields and Carbon Fields. Also in this article I am going to mention my own metabox plugin I developed for my needs which is Simple Fields.

The idea of this tutorial is to become more conscious to what plugins we are using to achieve our goals, because there are lots of slow WordPress websites out there, not because WordPress is slow but because sites are overloaded with tens and even hundreds heavy plugins.

Let’s look the truth in the face – of course I am going to tell you how cool my Simple Fields plugin is. But I am not going to say “use it”, because I understand clearly that sometimes its functionality is not enough, then you can probably look at Carbon Fields plugin. And even Advanced Custom Fields PRO has its own advantages though I am not a big fan of it.

2022 Year in Review

Looking back at 2021 year right now, I see that it was one of the greatest years but it ended up in chaos and depression and huge amount of time in 2022 I spent just trying to figure it out.

But anyway 2022 was a year of unexpected travels and hard work mode. I have done a lot of things I was struggling (or postponing) to do for years! Have visited 7 new countries and first time in my life tasted how it is to be a digital nomad.

Multisite Products Sync for WooCommerce

Let’s assume that you have a WordPress multisite network installed and some (or all) of the sites of the network are WooCommerce stores.

The thing is that sometimes you may need to sync WooCommerce products between the sites of your multisite network.

Because we are talking about WordPress Multisite we are not going to work with REST API, the tutorial will be all around switch_to_blog() function and CRUD layers.