In this article, we will explore how to customize permalinks in WordPress. Permalinks are the URLs that point to your individual posts, pages, and other content on your website. By customizing permalinks, you can create more readable and SEO-friendly URLs that reflect the structure and content of your website.
Permalink Types
WordPress offers different types of permalinks. Here are the three main types:
Plain Permalinks
Plain permalinks are the default permalinks in WordPress and are not SEO-friendly. They use query strings and have a structure like http://example.com/?p=123.
Pretty Permalinks
Pretty permalinks are more user-friendly and include the post name or title in the URL. They have a structure like http://example.com/sample-post/. Pretty permalinks are recommended for better search engine optimization (SEO) and improved user experience.
Almost Pretty Permalinks
Almost pretty permalinks are a variation of pretty permalinks and include a numeric identifier in the URL structure. They have a structure like http://example.com/archives/123.
Choosing Your Permalink Structure
To choose your permalink structure, follow these steps:
- Log in to your WordPress admin dashboard.
- Go to “Settings” and click on “Permalinks.”
- You will see several options for permalink structures. You can choose one of the common structures or create a custom structure using structure tags.
Structure Tags
Structure tags are placeholders that represent different elements in the URL structure. Here are some commonly used structure tags:
- %postname%: The slug of the post or page.
- %post_id%: The unique ID of the post or page.
- %category%: The category of the post.
- %year%: The year of the post’s publication.
- %monthnum%: The month of the post’s publication.
- %day%: The day of the post’s publication.
You can combine these structure tags to create a custom permalink structure that suits your needs. For example, /%category%/%postname%/ will include the category and post name in the URL.
Category Base and Tag Base
WordPress allows you to specify a base for category and tag URLs. Including a specific word or phrase before the category or tag slug in the URL can be useful. You can set the category and tag bases in the Permalinks settings.
Using %category% with Multiple Categories on a Post
If a post has multiple categories assigned to it, WordPress will only use the first category in the permalink structure. You can control the primary category by editing the post and selecting the desired category as the primary one.
By customizing your permalink structure, you can create SEO-friendly URLs that improve the visibility and accessibility of your content. Remember to choose a permalink structure that is meaningful, descriptive, and aligned with the structure and organization of your website.