Posted on Leave a comment

How Get Notified About Available Updates In WordPress For Free

How Get Notified About Available Updates In WordPress For Free 1

At the time of this writing, WordPress is the most popular blog platform on Earth and WooCommerce is the most popular e-commerce platform. That’s why they are the target of many malicious attacks. Keeping your WordPress (including themes and plugins) up to date is one of the most effective way to keep your site secure.

If you are like me, you’d probably have more than one website and there are sites that we visit more frequently than other. For sites that we visit the dashboard usually, we can update WordPress (including themes and plugins) very often. However, for sites that don’t get much attention, we may miss some updates, including important ones.

How to get notified when updates are available

You may wonder, since keeping WordPress up to date is vital, is there any way to keep us informed with the available updates? Fortunately, the answer is yes. Better yet, there is a plugin that does that job for free. Let’s learn how to install the plugin and configure it so you don’t miss any updates, especially critical ones.

Here is the step by step tutorial

Step 1. Install  and activate WP Update Notifier

First of all, you need to install a plugin called WP Update Notifier .

You can either download the .zip file following the link above or search for it in your site’s dashboard.

There is one small issue with the plugin is it hasn’t been updated for 3 years. While the main functionalities are working properly, there is a minor issue with deprecated function (function that no longer supported by WordPress). I’ve removed the line of code that caused the deprecated  notice and pack the plugin again here. You can download and install my version instead.

Download new version of the plugin

 

install update notifier from site dashboard

Step 2: Configure the plugin

After the plugin is activated, you can find its admin page under Settings->Update notifier

How Get Notified About Available Updates In WordPress For Free 2

You’ll see this page appears:

How Get Notified About Available Updates In WordPress For Free 3

The settings are straightforward and easy to understand. You can leave most of the settings to default. Here are the settings in details:

  1. Frequency to check: How often do you want the plugin to check for update? I usually set it Daily for my site but you can set it to Hourly or Monthly…
  2. Notify email to: by default, this is your admin email. This is the email you want to receive the update notification
  3. Notify email from: The email that appears in the from field of the notification email
  4. 4 and 5, check if you want to receive notifications about plugins and themes updates. I’d recommend you leave this enabled (yes)
  5. Hide core WP update nag… If you want to hide the WordPress core update notice from non-admin users (in case your site has other users with different roles) then select yes

Now, you can click on Save settings to save the options. If this is the first time you use the plugin, I’d recommend you click on the white button: Save settings with test email.

Troubleshooting

If your email setting is correct, you should have no problem getting update notifications to the email you specified above. However, some servers may not have the correct email sending function configured properly. If your site is hosted on such server, you may not get any email.

In that case, please check this guide here to fix the email sending function on your site.

Conclusion

Now you don’t need to worry about your site is not at risk because your WordPress core or themes or plugins are not up to date. With WP Update Notifier, you can act instantly once updates are available.

Posted on Leave a comment

How To Disable XMLRPC Without Using Plugin

XML-RPC is a protocol that let you send data over HTTP. In WordPress, you can use this protocol to manipulate various things on your site including posts creating, deleting, editing… However, it is a dying technology and has high risk potential.

It is recommended for WordPress users to disable it entirely. By default, your WordPress installation has this enabled.

If you need more details about XML-RPC and its risk, this post should be sufficient.

How to disable XML-RPC without using a plugin

The good news for you is disabling XML-RPC is very simple. You only need to add one line of code. As usual, I would recommend you enter this code in your child theme. If you don’t know how to create one, I have a detailed tutorial here:

Picture Guide To Create Child Themes In WordPress Step By Step

After that, paste the following code in the child theme’s functions.php file:

add_filter( 'xmlrpc_enabled', '__return_false' );

The code basically add a function to xmlrpc_enabled hook. When this hook is fired, the function __return_false is called.

If you know a bit a PHP, you may wonder, where is the implementation of the function __return_false? The answer is it is a WordPress’s method to conveniently return false, which is all we need to disable XML-RPC.

Conclusion

Disabling XML-RPC is very simple and you should be able to do it without any problem. If you need help, please comment below. If you don’t use or don’t know what XML-RPC is, you should definitely disable it now.

Posted on Leave a comment

The Ultimate Guide To WordPress For Beginners 2019

WordPress For Beginners

Are you a complete WordPress beginner? If so, this WordPress For Beginners post is for you. After completing this post, you’ll have what it takes to create awesome WordPress sites right away.

WordPress is an awesome platform for creating all kind of sites. It started as a blogging platform. However, nowadays, people use WordPress for all sorts of purposes. I use WordPress for blogging, selling products and even building web API. If you are a complete beginner to WordPress, this post is for you. It will be long since I’ll try to cover every important parts in WordPress. However, to make it easy for you to read and understand, I will break the content down to atomic pieces so you can quickly grasp a new WordPress concept.

Let’s get started

WordPress.org and WordPress.com

As a beginner, you may be confused these two sites together. They are owned by Automattic, the company that develop WordPress. However, on WordPress.org, you will download a piece of software and install on your own domain to create your site. If you go to WordPress.com, you can create a blog to start writing away without any setup. Let’s compare these two sites to see their pros and cons:

WordPress.com

PROS

  • You can create a free blog that ends with .wordpress.com
  • It’s completely free
  • There is no setup, the site is done for you.

CONS

  • You don’t have much control over the site
  • The site is owned by WordPress.com so you cannot install plugins, themes, edit files
  • The storage is limited to just 3GB.
  • You cannot use WooCommerce to sell products

WordPress.org

PROS

  • It’s completely free
  • You have full control over your site
  • Since you are in complete control, you can install themes, plugins, edit files
  • You own your own domain

CONS

  • You have to install it on your own server. That means, you must buy hosting and domain. This part is easy though.

So, as you can see, each choice has its own pros and cons. If you just want to create a free blog and write content, go with the first option. However, if you are serious about your business (even blogging business), by all means go with option 2 (buy domain, hosting and install WordPress download from WordPress.org).

In this post, we are going to talk about the version that you install on your own server.

Next, we will find out how you can add content to your site via pages and posts and how to customize your site’s look and feel using themes and plugin.

Getting familiar with the admin panel

After creating your site, you usually go to yoursite.com/wp-admin to access the admin panel of your site. This is the place you do all the managing tasks from creating, deleting content, adjusting site appearance, install, remove plugins…

the-wordpress-admin-panel

Here are the most important sections places in this admin panel you need to pay attention to. Each section has its own sub sections to provide you maximum flexibility when working with WordPress.

  1.  You can view your site clicking on this section
  2. Click here to manage your posts. You can create, edit, delete your posts here.
  3. Media is where you manage files, images, videos.
  4. Create your pages here. Similar to the posts section, you can add, remove and edit pages here
  5. Comments is the section where you manage comments on your site. When you add content to your site, if you enable the comment functionality, then people visit your site can leave a comment to share their opinions.
  6. Appearance is the place you manage your themes. Theme determine how your site look so it is very important. In WordPress, there are many free and good themes for your to select from. If you want to use more advanced designed, you may need to buy and install premium themes.
  7. Plugins are the software that created to extend the functionalities of your WordPress website. In this section, you can add, remove plugins with just a few clicks. WordPress has a free plugin repository that contains many good plugins. However, similar to themes, you may need to buy premium plugins to achieve some specific features.
  8. Users are where you can update your name, your password, your email… If you are the administrator, you can add and delete other users on your site.
  9. Settings is where you can set many important options for your site such as site’s title, site’s description, permalink structure (the way your URL display).

OK, now you have a basic understanding of the admin panel. Let’s dive right in to some of the most important sections.

Creating content with posts and pages

Post is the most common type of content on any website. In WordPress, everything is a post. A page is a post, a product (WooCommerce) is also a post (it is called a custom post).

To create a post, simply click on Posts. You’ll see the menu on the left of the admin panel expand:

The Ultimate Guide To WordPress For Beginners 2019 4

As you can see, under Posts there are some new items:

  • All posts: Show all posts on your site
  • Add new: Add a new post
  • Categories: Manage posts categories. You can divide posts in to as many categories as you like. For example, you write about phones so you can have two categories: iPhone and Android. Your categories may also have child categories. For example, under Android, you may have: Samsung phones, HTC phones, Google phones…
  • Tags: Tags are similar to categories. They are another way to group posts together. For example, if you write one post about HTC phones, another for Samsung phones, you can add the tag “android phone” for these two posts. There are no limit on how many tags you can have per post.

Now you have a basic understanding of the posts section. Let’s start creating a post. To create a post, you can click on Add new. There are two locations, you can click on either one.

The Ultimate Guide To WordPress For Beginners 2019 5

After click on Add new, you’ll see this:

The Ultimate Guide To WordPress For Beginners 2019 6

If you don’t see an interface like above, don’t freak out. You’d probably see something like this:

The Ultimate Guide To WordPress For Beginners 2019 7

Why there are two editors? Why is this confusion? You may ask. The answer is from WordPress version 5, the new editor (named Gutenberg) is the default editor. Before that, WordPress used the classic editor. If you like working with the classic editor, you can install this plugin to disable Gutenberg.

How to create new post with the classic editor

Creating a post with the classic editor is super easy. You just enter the post title, post content then hit the publish button and your content is live. The post will have an URL (similar to an address) that you can send to other people to read your content. Let’s inspect the classic editor to see the most important sections:

The Ultimate Guide To WordPress For Beginners 2019 8

As you can see from the picture, there are 7 important areas when creating posts with the classic editor:

  1. Post title: This is the title of your post. It should not be blank (though you can leave it blank and publish)
  2. Post content: This is where you put the content of the post in. Think about an article you have just read. The article content should be written in this section
  3. Categories: Here you can select categories for the post. As mentioned earlier, one post can have more than one category. The default category is “Uncategorized”. However, you can create new categories and set them to the new post
  4. Add tags: tags are important parts of your post since it’s a way to group posts that share topics together. Unlike categories that must be pre-defined, you can enter whatever you like.
  5. Preview post: After creating the content, you can hit the Preview button to see how it looks like on the website.
  6. Save draft: If you are not ready to publish yet, you can save the post as a draft and continue to work on the post later. A draft post can be seen only by the editor/author/administrator (sounds confusing? These are the roles of users in WordPress). People who don’t have access to the admin panel don’t know this post exists, even search engines.
  7. Publish: When you are ready to present your post to the world, press this button.

For example, I published a new post on my site. Here was what I got after clicking on the publish button:
The Ultimate Guide To WordPress For Beginners 2019 9

Now you can click on “View post” link to view your post.

Creating your post in Gutenberg editor

Gutenberg is the new WordPress editor that has made default from version 5. There is a fact that not many people like it. If you look at the Gutenberg plugin on WordPress.org, you’ll see it has very low rating.

The reason partly because of people are used to the classic editor and at the beginning, Gutenberg was buggy (it still has some bugs but I saw great improvements since the first version).

Gutenberg is known as the “Block Editor”. Let me show you what it has that name:

As you can see how Gutenberg is different from the classic editor. Instead of entering all content in a giant box, now, you add “blocks of content” to the post by clicking on the (+) sign. For me personally, I prefer to work with the traditional classic editor since it’s simpler. However, Gutenberg editor has some advantages that the classic editor can only dream of:

  1. With Gutenberg, users can have columns. Meanwhile, in classic editor, you write content in one column
  2. You can insert various elements, including buttons. In the classic editor, if you don’t know HTML, it is hard to create such elements in post
  3. Adding more custom blocks is another strength of Gutenberg editor. You can add more blocks to the editor if you know code. If you don’t, there are plugins available that let you insert all kinds of elements to the post. You can think of Gutenberg is the new page builder such as Elementor, Visual composer…

WordPress Pages vs Posts

As I mentioned earlier, page is a type of post. However, pages are designed to be good for static content (content that don’t change or need update). Usually, you would use a page to create contact us page, about page…

Unlike posts, pages don’t have categories.

Change your site’s appearance with themes

Now you’ve known how to create pages and posts. It’s time to style your site to match your taste.

To manage your themes, go to Appearance-> Themes

themes in wordpress

As you can see, I have three themes installed: Twenty Nineteen, Twenty seventeen and Twenty Sixteen. These are the default themes come with the latest WordPress installation.

Activate and deactivate themes

Take a look at the first theme: Twenty nineteen. You’ll notice that it has the word “Active” before the theme name. That means the theme is currently active. In fact, when you activate a theme, it will be moved to the first position of the themes list. For example, if I activate the theme Twenty Sixteen, you’ll see it at the first position.

To activate a theme, simply hover your cursor over that theme:

The Ultimate Guide To WordPress For Beginners 2019 10

Then, click on the Activate button. You can also click on Live Preview button to see how your site look with the new theme before deciding to activate the theme or not. This feature is very helpful when you have a site running and you don’t want to constantly surprise your visitors by switching through many themes.

Activating one theme will deactivate the current active theme. There is no deactivate button. This makes sense since your website always need to have an active theme.

Installing new theme from WordPress repository

As mentioned earlier, there are thousands free themes available on WordPress.org. To add a new theme from this source, simply click on Add new button at the top of Themes screen:

The Ultimate Guide To WordPress For Beginners 2019 11

Then, you’ll see next screen with full of themes:

The Ultimate Guide To WordPress For Beginners 2019 12

As you can see from the part that I underlined with a blue bar, there are options to filter the themes. You can browse featured, popular, latest… themes with just one click. If you know the name of the theme or a feature (one column, light weight…), you can enter the search phrase into the search box to search for the themes.

To install a theme, simply hover your cursor onto that theme, you’ll see the Install button appears:

The Ultimate Guide To WordPress For Beginners 2019 13

If you click on install, WordPress will go ahead and download and install the theme. After the installation is done, the theme will be available in your list of installed theme (You can click on Appearance -> Themes again to see the list of installed themes).

Install new theme from a .zip file

In many cases, free themes don’t have the features you are looking for. It’s time to purchase a premium theme. After purchasing the themes, you will be given a .zip file. Then, you need to upload that .zip file to your site to start using the theme.

To install a theme from a zip file, simply click on Appearance->Themes->Add new:

The Ultimate Guide To WordPress For Beginners 2019 14

Click on Upload Theme button, you’ll see a new section where you can upload the zip file:

The Ultimate Guide To WordPress For Beginners 2019 15

Now, click on Choose file, you’ll see a file selector window appear. Let’s navigate to the zip file on your computer and select it to start uploading:

select the zip file to upload and install

In the screenshot, I select the famous Flatsome theme (one of the most popular theme for WordPress sites that run as a shop). With the file selected, click on Open.

Notice that I’m using Windows. If you use Mac or Linux, you will see a slightly different interface when selecting the zip file. However, I believe that you have no trouble selecting files for upload in those platforms.

After selecting the zip file, I’ll click on Install now to start uploading and installing the theme.

Depending on the size of your theme, the process may take from a few seconds to about a minute.

premium theme installed successfully from zip file

If there is no problem with the upload and install process, you’ll see the the screen above. You can preview the theme by clicking on Live Preview or click on Activate to activate the theme right away.

Add additional functionalities with plugins

Now you know how to work with themes, working with plugins is much easier. Adding, removing plugins are similar to what of themes. Similar to themes, there is a free repository of plugins on WordPress.org.

What are plugins?

Plugins are software that add new functions to your WordPress site. They may modify a default function of WordPress. Earlier in this post, I mentioned that you can disable Gutenberg editor and enable the classic editor using a plugin. That is an example of how plugins work in WordPress.

Plugins are powerful. Later, you will find out about WooCommerce. It is a plugin that turns your site into an ecommerce store. WooCommerce is the most popular e-commerce solution on the internet today.

States of a WordPress plugin

A plugin installed on your site has two states:

  1. Activated
  2. Deactivated

Only when activated, the functions of the plugin can take effect. If one plugin is deactivated, it has no effect on your site.

Manage plugins on your site

To manage plugins on your site, simply go to Plugins->Installed plugins on the left menu of your dashboard:

manage installed plugins

Then you’ll see the list of installed plugin on your site. In the screenshot, you can see that I have two plugins called “Classic Editor” and “LaunchPage.app Importer”. You can see that they are both deactivated (since there is a “activate” link under each plugin).

Activate & Deactivate plugins

To activate any plugin, click on the Activate link under that plugin’s name.

For example, I’m going to activate “classic Editor”.

successfully activating plugins

As you can see from the screenshot above, the background of “classic editor” turned to light blue. The link below it changed to “Deactivate”. Also, there is a notice at the top of the screen says: “Plugin activated”.

Now, if you want to deactivate any plugin, simply click on “Deactivate link” under that plugin.

Delete a plugin

You can only delete a plugin when it is deactivated. From the screenshot above, you can see that under “Launchpage.app Importer”, there is a red link called “delete”. Simply click on that and confirm   you want to delete the plugin to permanently wipe that plugin from your site.

Install plugins from WordPress respository

To install a new plugin from WordPress.org repository, you simply click on Plugins->Add new

add plugins from wordpress repository

By default, you’ll see the list of featured plugin. Similar to add theme screen, you can switch to Popular, recommended tabs to see other sets of plugins. If you connect your site to your WordPress.org account, (a free account that let you participate in WordPress.org forum and review plugins, themes) you can see your favorite plugins in the Favorites tab.

You can also search for plugins using the search box.

As you might notice, there is a “Install now” button at the right of every plugin. If you want to install a particular plugin, click on that button. WordPress will start to download and install that plugin for you.

The button’s status will change to “Installing”

install now button change to installing when clicked

When the installation is done, that button will change to Activate.

button changed to activate

You can click on the Activate button to activate the plugin.

Manage access to your site with user management

What are users?

Simply put, users are the ones that have access to the admin panel. To login to the admin panel, all users need to enter their username/email and their password.

What are user roles?

Not all users in WordPress are equal. Users are differentiated by their roles. The role of a user determines what he can and cannot do on the site. By default, WordPress has the following roles:

  • Subscriber
  • Contributor
  • Author
  • Editor
  • Administrator

The subscriber has least power while the administrator has the most power.

How to add new users

To add a new user, you must be an administrator. By default, when you first create your site, you are give an account with administrator role.

Now, click on Users->Add new to add a new user:

add new user in wordpress

You can see that there are a few fields that required. You must give the new user a user name (no space, no special characters) and an email. If you create an account for someone, make sure you enter the email correctly since the password creation link will be sent to that email.

You can also create a password for that user (by clicking on Show password button) to set the password yourself.

Finally, make sure you select the right role. Be very careful when you create Editor or Administrator account since these accounts can do much damage to your site (since they have much power) if the one who own those accounts are malicious or not careful.

To create the account, click on create account button at the bottom.

How to remove users

To remove a user, you also need to be an Administrator. Now, go to Users->all users to see the list of users on your site:

The Ultimate Guide To WordPress For Beginners 2019 16

Now if you hover your cursor on the user, you’ll see the Delete link appears with the red color. To delete any account, click on the Delete link right below it. You’ll see this screen appears:

The Ultimate Guide To WordPress For Beginners 2019 17

Click on the button “Confirm Deletion” to delete the user. If you go back, the user is not deleted.

Configure your site settings for SEO

To write about WordPress SEO, I may need to write a complete book. However, with some basic initial adjustments, you can setup your site for SEO success.

Setting up the site title correctly

If you are serious about your site (I know you are), setting up the site title correctly is very important. Site title is usually short and  have little SEO effect. However, it reflects your website, your brand. Later, people may search for your site to get to your content. So, choosing your site title is very important.

To set your site title, you go to Settings->General

change site title and tag line

Here, you can change the site title and the tag line in the boxes that I underlined with blue color.

After entering the title, make sure you scroll to the bottom of the page to click on Save changes to store your change to the database.

Setting up SEO friendly URL with permalinks

For years, the URL has played a big part in SEO. WordPress offers extensive support for SEO friendly URLs. Click on Settings->permalinks:

setting up permalinks for wordpress site

By default, you have six options for your permalink. (permalink is the structure of the URL of your pages/posts). It is recommended that you choose the URL format that when someone see it, he can tell what’s the content is about.

Take the first structure for example (Plain), you cannot tell much about the content. If someone knows WordPress, he can tell that that’s the link to a page/post that has the ID 123. However, take the structure 2,3,5 for example. The URL contains human readable text that tells exactly what the content is all about.

I usually go with the “Post name” structure to keep the URL short. However, you can choose Day and name or month and name structures if you want to include publishing date in the url

Conclusion

This is quite a long post that give you a brief introduction of WordPress. There are a lot more to learn about WordPress and I hope you’ll stick with me in this journey.

I’ll keep updating this post so make it more extensive and up to date. If you have questions, please let me know in the comment section below.

This site is built with WordPress 🙂

Posted on Leave a comment

The Ultimate Guide To WordPress Navigation Menu

navigation menu

A navigation menu is not something alien to webmasters today. It’s a must have for any website. In WordPress, menu are created automatically for you the time you set up your site. However, do you know that you can create your own menu, set your own styles for the menu? Sounds interesting? Let’s get started.

How to create a navigation menu in WordPress

Create a menu is super easy in WordPress. Simply go to Appearance->Menus:

menu dashboard in wordpress with no menu yet

As you can see, I have no menu created yet. Let’s create one.

In the Menu name box, enter the name of the menu. It can be anything. As I’m going to create a primary navigation menu, I’ll call it primary nav.

Now, click on create menu.

create a blank menu

You can see that we have a new menu called primary nav but there isn’t any item on it yet. Let’s add some.

How to add your WordPress pages to the menu

On the left, you’ll see the list of items you can add to the menu:

items you can add to the navigation menu

Click on Pages, for example, you’ll see the list of pages of your site:

list of pages to add to navigation menu

To add any item to the navigation menu, check the checkbox in front of that item and click Add to menu.

How to add custom links to the menu

There are times you may want to add external links to the menu (pages that are not on your site). It’s super easy to add such links to the menu. Let’s click on custom links:

add custom link in wordpress menu

As you can see, there are two boxes for you to enter the details. Let’s enter the URL you want to point to in the URL box and the text you want to display in the Link Text box.

For example, I add a link to Google with the link text “Search Engine”. It’ll look like this:

adding a custom link

After clicking on Add to menu, it appears on my menu:

custom link on menu

Now, let’s add some other items to the menu to finish the creation of our menu. Make sure you click on the “Save Menu” button to save all your changes. Here is the final version of my menu:

menu with items

How to change the order of menu items

As you notice, the order of items is the order you add them to the menu. First added items appear first and so on. So, does that mean you need to delete and re-add the items if you wan to change the order? Fortunately, not.

You can drag the items up and down to change the order they appear in the menu:

drag to re-order items in wordpress menu

As you drag, you can see that there is a dotted box appear. If you release the mouse, the item you are dragging will fit into that dotted box.

How to create menu hierarchy (Create child menu items)

There are times you want to create a menu item that contains other items (children). You can do this by click and drag too. For example, I want to make Cart item is a child of Shop item. I’ll click and drag the cart under the shop (still hold the mouse) and then drag a little bit to the right:

drag and create child in wordpress menu

As you can see, the dotted box is aligned a bit to the right of the shop item. That means if you release the mouse now, the cart will be a child of Shop.

You can even drag an item under the Cart item and make that item a child of Cart. There is no limit of the number of levels you can create in your menu.

Make sure you click on Save Menu to save your changes.

Why don’t I see the menu

If I view my site now, I don’t see the menu I’ve just created. Instead, I may see no menu or the default menu that WordPress creates for me (consisted of all pages in my site). So, how to make the menu   appears at the location(s) I wanted?

It’s time to talk about menu locations.

What are menu locations

Menu locations are locations that you can display the menu and is defined by your theme.

That means if you use a different theme from mine, you may have less or more locations to put your menu. In addition, the locations may be different.

Now, still in Appearance->Menus scree, click on Manage Locations:

menu locations in wordpress

As you can see, my theme offers two menu locations, one is Primary menu, the other is footer menu.

Now, each location has a select box to let you select the menu you want to display at that location. The menu I’ve created in the previous step is available in these select box.

Now let’s select it for the Primary Menu location:

select menu for location

Click on Save changes and view the site:

menu appears at correct position

Sure enough, we have the menu at the right place and the Cart item is the child of the Shop item.

Can I have the menu at this place?

Often times, you may need to display a navigation at places that isn’t support by default by the theme. One example is to display the menu inside page, post… If this is what you want, you may need to use a plugin to achieve the result.

There are plugins that available in the WordPress repo. However, they are not supported for quite a long time so it’s quite risky to use them. If you have this need, please let me know and I’ll create one. It should be very simple.

Conclusion

Hopefully you’ll find working with WordPress menu easier now. If you have any suggestions/questions, please let me know.

Posted on Leave a comment

How To Quickly Add Child Categories In WordPress

How To Quickly Add Child Categories In WordPress 18

Adding child category and blog’s hierachy is as tedious task if you have many categories to manage. My website has a lot of categories too so I think there must be a better way to add child categories to current category.

So, I decided to make a plugin to solve this problem. It is a very simple plugin that help you quickly create child categories. Initially, it supports WordPress’ categories only. Now, WooCommerce categories are also supported.

Since the code is very simple, you can implement the functions without installing a plugin. I’ll provide the code in the section 2 of this post.

Quickly adding child categories using plugin

You can download the plugin below:

 

How To Quickly Add Child Categories In WordPress 19

As you can see, when you click on the + child button, the Parent category select box is automatically changed to the category you select. Then, you can simply go ahead and details for the child category and click on add new category button as usual.

I’m submitting the plugin to WordPress.org so you can download the plugin directly from that site. I also added support for WooCommerce categories so you can now quickly add child categories to current WooCommerce categories too.

Quickly adding child categories WITHOUT using plugin

If you don’t want to use the plugin, you can paste the code below in the functions.php file of your child theme. Click here if you don’t have one and wonder how to create a child theme in WordPress.

 

add_filter('category_row_actions', 'binary_carpenter_quick_add_child_add_option', 10, 2);
add_filter('product_cat_row_actions', 'binary_carpenter_quick_add_child_add_option', 10, 2);
add_action('admin_print_scripts', 'binary_carpenter_quick_add_child_print_js', 10, 2);

function binary_carpenter_quick_add_child_print_js()
{

    global $current_screen;

        if ($current_screen->id === 'edit-category' || $current_screen->id === 'edit-product_cat')
        { ?>
            <script>

                document.addEventListener("DOMContentLoaded", function(event) {

                    var add_child_buttons = document.getElementsByClassName('bcqac-item');

                    for (var i = 0; i < add_child_buttons.length; i++)
                    {
                        add_child_buttons[i].addEventListener('click', function(e){
                            e.preventDefault();
                            //set the parent category to the current parent category
                            var parent_id = this.getAttribute('data-parent-id');
                            var parent_select = document.getElementById("parent");
                            parent_select.value = parent_id;

                        });
                    }

                });



            </script>
        <?php }
}

function binary_carpenter_quick_add_child_add_option($actions, $tag)
{
  $actions['add_child'] = sprintf(
    '<a href="#" data-parent-id="%s" class="bcqac-item" >%s</a>',
    $tag->term_id,
    /* translators: %s: taxonomy term name */
    __( '+ child' )
  );

  return $actions;
}

Save the functions.php file and you are done. Now, you can quickly add child categories in WordPress and WooCommerce.

Conclusion

I can now quickly create child category in WordPress and WooCommerce. As I’m creating the hierarchy for this blog, this tool becomes very handy. If you have any suggestions, please let me know in the comment section below.