Hướng dẫn loại bỏ ngày đăng bài khỏi URL trên WordPress

Are you looking to remove the date from your WordPress URL? WordPress comes with an SEO friendly URL structure by default, with the date and post name in the URL. In this article, we will show you how to easily remove the date from your WordPress URL.

Why are dates appearing in WordPress URLs?

By default, WordPress uses the following ID-based URL structure:

https://example.com/?p=123

This URL doesn’t look good and doesn’t represent the article at all.

However, WordPress allows you to easily change this address to more meaningful and SEO friendly URLs. WordPress gives you a bunch of options under Settings » Permalinks .

Selecting the Month and name or Day and name options will add date parameters to your WordPress URL. They will then look like this:

Day and name: https://example.com/2020/09/03/sample-post/

Month and name: https://example.com/2020/09/sample-post/

These URLs are better than the default ugly URLs, but they are unnecessarily long and the date makes your old posts look like they haven’t been updated very often.

That’s why many users want to switch to the Post name URL structure, which removes the date and only uses the post slug in the URL.

Name: https://example.com/sample-post/

This structure is shorter, makes sense, is SEO friendly, and doesn’t make the article look outdated over time.

Things You Should Consider Before Removing Dates from WordPress URLs

If you are starting a new WordPress blog and haven’t put it online yet, you can feel free to remove the date part from your WordPress URL.

However, if your website has been around for a while, then you need to keep the following in mind.

Changing your URL structure can result in 404 errors for users and search engines. This means you may see warnings and errors in your Google Search Console reports.

Your search engine rankings may also suffer as links to your old articles will now lead to a 404 page.

Both of these issues can be fixed by setting up redirects. We’ll show you how to do that later in this article.

Changing the URL structure will also reset the social share count. Unfortunately, most social share counting services do not update redirected URLs and will reset their share counters.

Video tutorial

If you want written instructions, just keep reading.

Remove Date from WordPress URL

First, you need to create a complete WordPress backup of your website. This will allow you to restore your website to a previous state in case things don’t go as expected.

Next, you need to visit Settings » Permalinks page and select the Name option .

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

WordPress will now remove the date from your WordPress URLs and start using a post name based URL structure.

Set up redirects to maintain SEO rankings

Now that you have removed the date from your WordPress URL, you need to set up redirects for your old posts accordingly.

The redirect feature will take users to the updated URLs without displaying a 404 error. This will also help search engines understand that the old URLs have now moved to these new URLs.

First, you 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  and click on Start setup button .

The plugin will then show you a few options. Redirection can automatically detect and alert you if a post URL changes and keep a redirect log. You can also uncheck both of these options and just click the Continue setup button .

The plugin will then run some tests and if everything is ok, you can click on the Finish setup button . The plugin will then save the settings to your WordPress database.

Slot Resmi

Slot Qris

Once done, you will see the plugin’s settings page. From here, you need to click the Add New button at the top or scroll down to the Add new redirection section .

You will see a form with Source and Target fields . Source is the field where you will describe your old URL structure and Target is the location of the new URL.

If you are using Day and name URL , then you need to enter the following values ​​in the Source field and Target field :

Source: /(\d*)/(\d*)/(\d*)/([A-Za-z0-9-*])

Target: /$4

If you are using a Month and name URL , you would enter the following values:

Source: /(\d*)/(\d*)/([A-Za-z0-9-*])

Target: /$3

Don’t forget to select Regex and click the Add Redirect button to save the changes.

The plugin will now redirect users to URLs based on the rule you just added.

We hope this article helped you learn how to easily remove dates from URLs in WordPress. You may also want to check out our guide on the most common WordPress errors and how to fix them, as well as our collection of the best WordPress SEO plugins.

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