How to Change the Category Base Prefix in WordPress

Do you want to change the category base prefix in WordPress? By default, WordPress automatically adds /category/ as a prefix to URLs for all category pages. In this article, we will show you how to change the category base prefix in WordPress. We will also… Read More »

The post How to Change the Category Base Prefix in WordPress appeared first on WPBeginner.

Do you want to change the category base prefix in WordPress? By default, WordPress automatically adds /category/ as a prefix to URLs for all category pages. In this article, we will show you how to change the category base prefix in WordPress. We will also talk about whether or not you should remove the base prefix altogether.

How to change the category base prefix in WordPress

What is Category Base Prefix? Should You Change It?

Each category on your WordPress site get its own page and RSS feed. You can view all posts filed under a category by visiting that category archive page.

By default, WordPress adds ‘category’ as base prefix to URLs for category pages. This helps differentiate pages and posts from category and tag archives.

For example, if you have a category called ‘News’ then its URL will look like this:

http://example.com/category/news/

Similarly, WordPress also adds tag prefix to URLs for tag archives.

http://example.com/tag/iphone/

This SEO friendly URL structure helps users and search engines understand what kind of page they are visiting.

Most websites don’t need to change the base prefix at all. However, if you are creating a niche site where you would like to use a different word or phrase for your categories, then you can change the category base prefix to reflect that.

Changing Category Base Prefix in WordPress

Changing category base prefix is quite simple in WordPress.

You need to visit Settings » Permalinks page and scroll down to the ‘Optional’ section.

Changing category base prefix in permalink settings

Here you can enter the prefix you would like to use next to the category base option. You can also change the tag base prefix if you want.

Don’t forget to click on the save changes button to store your settings.

Setting up Redirects After Changing Category Base Prefix

If you are changing category base prefix on a new website, then you don’t need to do anything. However, if you are doing this on an existing website, then users visiting the old category page will see a 404 error.

To fix this, you will need to setup redirect to make sure both search engines and regular visitors are properly redirected to the correct category page on your site.

First you will need to install and activate the Redirection plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Redirection page to setup redirect.

Setting up redirect after changing category prefix

Scroll down to ‘Add new redirection’ section.

First, you need to add /category/(.*) in the source URL field. After that you need to check the box next to the regular expression option.

In the target URL field, you need to add your new category base prefix like this /topics/$1. Don’t forget to replace topics with your new category prefix.

Click on the ‘Add Redirection’ button to save your changes.

That’s all. Now all your users and search engines will be redirected to the correct URLs using your new category prefix.

Removing The Category Base Prefix in WordPress

Many of our users have asked us about removing the category base prefix from WordPress URLs altogether. This will change your category URLs to look like this:

http://example.com/news/

This is not a good idea, and we recommend that you do not remove category base prefix.

Category base prefix helps both users and search engines distinguish between posts/pages and categories. Removing the prefix makes your URLs ambiguous which is not good for user experience or SEO.

You may also run into technical issues with various WordPress plugins. For example, if you have a category and a page with the same name or when you are using %postname% as your URL structure for single posts, then your site will experience infinite redirect loop causing the pages to never load.

However, if you still want to do this, then you need to install and activate FV Top Level Categories plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin works out of the box and will immediately remove the category base prefix from your category URLs.

We hope this article helped you learn how to change the category base prefix in WordPress. You may also want to see our list of most wanted WordPress tips, tricks, and hacks.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Change the Category Base Prefix in WordPress appeared first on WPBeginner.

How to Add a Favicon to Your WordPress Blog

Adding a Favicon to your website is critical to it’s identity. The favicon of a website is like your photo in your ID Card. Just like the photo identifies you, people can identify your site by a favicon, if you have a unique one. In this article we highlight how you can add a favicon to your WordPress blog.

To leave a comment please visit How to Add a Favicon to Your WordPress Blog on WPBeginner.

Favicon or Site Icon is the tiny image that appear next to your website title in the browser. It helps your users identify your website and more frequent visitors of your site will build an instant recognition for that tiny image. This increases your brand recognition and helps you build trust among your audiences. In our article about most common WordPress mistakes, not adding a favicon was among the top 25. In this article, we will show you how to add a favicon to your WordPress blog.

Why you should Add a Favicon to Your WordPress Site?

As we mentioned earlier that it establishes your website’s identity. However, it also improves your site’s usability and user experience. This image will help you understand it better:

Favicons in Browser Tabs

Most users usually have many tabs open in their browser window. This hides your website’s title as the number of tabs increase. The favicon helps user identify your website and quickly switch to the tab they want.

You can ask your users to add your site to their homescreen on mobile devices. Your site icon or favicon is also used when a user adds your site to their homescreen on a mobile device.

Site icon displayed as the app icon on the homescreen of a mobile device

How to Create a Favicon

You can use your brand’s logo as your site icon or favicon. The recommended size for your site icon image is at least 512 pixels in both width and height. The site icon image should be a square, you can use a larger rectangular image and WordPress will allow you to crop the image when you add it.

Creating a site icon for your WordPress blog using Adobe Photoshop

We recommend using an image editing program like Adobe Photoshop or Gimp to create a site icon of exactly 512×512 pixels. This way you can maintain exact proportions for your image. You can use transparent image or fill the image with a background color of your choice. This image could be in png, jpeg, or gif format.

Adding Your Site Icon or Favicon in WordPress

Since WordPress 4.3, you can add a favicon or site icon from WordPress admin area. Simply go to Appearance » Customize and click on the ‘Site Identity’ tab.

Site identity in Customizer

The site identity section in customizer allows you to change the site title, description, and control whether or not you want to display them in the header. It also allows you to upload your site icon. Simply click on the select file button and then upload the image you want to use as site icon.

Adding site icon and favicon in WordPress

If the image you are uploading exceeds recommended size, then WordPress will allow you to crop it. If it matches the recommended size exactly, then you can just save your changes.

That’s all you can now preview your site and see your favicon in action. You can also visit your site on a mobile device and then from the browser menu select “Add to homescreen’. You will notice that your site icon will appear on the homescreen.

Adding Favicon to Older WordPress (4.2 or below)

Upload your favicon to your website’s root directory using FTP. After that you can simply paste this code into your theme’s header.php file.

<link rel="icon" href="http://www.wpbeginner.com/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.wpbeginner.com/favicon.png" type="image/x-icon" />

Replace wpbeginner.com with your site’s URL and you are good to go. If your theme does not have a header.php file, or you can not find it, then don’t worry we have a plugin for you. Install and activate Insert Headers and Footers plugin. After activating the plugin go to Settings » Insert Headers and Footers and paste the code provided above in the header section and save your settings.

If you don’t want to deal with FTP at all, then you can also use the plugin called All in One Favicon.

We hope that this article helped you add favicon to your WordPress site. For questions and feedback you can leave a comment below or catch us on Twitter.

To leave a comment please visit How to Add a Favicon to Your WordPress Blog on WPBeginner.