Posted on

How to Create a Custom Bulk Action

WordPress 4.7 introduced a way to create your own custom bulk actions for your post types.

Before that, there were plugins to do it, but now that it’s in the core, it’s way easier to add a new bulk action, potentially you only need three functions!

Let’s see an example together about how to add a Move to Drafts bulk action, I know that is already possible if you bulk edit posts, but it involves many clicks, while with a bulk action is only a couple clicks!

Continue reading How to Create a Custom Bulk Action

Posted on

Pluck Fields Out Of an Object or Array

Some days ago I was working on a project and I needed to get out of an object some data, but not all of them. Specifically, I had many terms, and I needed to get only the key name from that object.

What I would have done, is looping though all the items and build an array from that with their names. But I learned about a better way!

Continue reading Pluck Fields Out Of an Object or Array

Posted on

Scheduled Events and WordPress Cron Jobs

A clock

When I say scheduled events, I don’t mean the awesome party that you may want to sell on your site, no. The scheduled events I’m talking about are actually events that occur in WordPress.

An example would be a scheduled sale on WooCommerce, or a scheduled post in your blog that you want to publish in the future.

You can create such events also by yourself, for your theme or your plugin. Like I said before, WooCommerce uses scheduled events for sales, that’s a custom one. I used them to sync two different blogs with a plugin.

If you want to learn how to use scheduled events in WordPress, keep reading!

Continue reading Scheduled Events and WordPress Cron Jobs

Posted on

Searching The Code

I’m sure that at least once you had to search something in the code, even if you are not a developer. Maybe a support technician told you that you can customize your site using WordPress actions, or you simply need to know the name of a function.

Well, searching into the code is not as easy as it seems, but I’ll try to explain here how I do it so that you can do it easily and quickly.

Coding knowledge are not required, but it would be very helpful if you can understand what you read.

Continue reading Searching The Code