It is essential to have optimized and straightforward links for your posts. When someone searches for a particular subject, they look at the link first before deciding to click. Thus, if it shows an outdated date, they will definitely think twice about accessing the particular site. In this format, ‘www.mysite./2011/02/22/postname’.

Therefore, it is essential to change the permalink, but don’t remove the publish date. You may have written an article some years back with the latest technology. However, as time goes by various technologies, software, recipes, DIY and trends might have changed.

Thus, when a reader gets outdated information, they may end up leaving the site without further ado.

However much you may see the need of hiding your publish date, make sure you update the content on a regular basis to ensure the content remains fresh.

Let’s focus on what the permalinks options are:

 

By default the WordPress posts permalinks normally appear with the day and name. This may cause some bit of inconvenience as we noted earlier. However, if it is a news website, it is essential to have the date shown. However, if the blog is about current, normal issues and bugs you may opt to change the permalink option.

You just need to access the WordPress dashboard, on the left side click on settings which will then bring other options. You may then click permalinks and change the option as desired.

Well, that’s not all; there is more to this.

 

How to prevent old URL’s from generating a 404 error

After changing the permalink option, the old URL’s that the search engines had adapted still remains. Thus, it is essential to fix this to prevent readers from getting a 404 error after clicking on the link.

  • Plugins

There are various plugins that you can download to fix the errors such as, Redirection wordpress plugin, Yoast SEO(using its redirect generator), simple 301 redirects, and safe redirect manager.

 

  • .htaccess file

On the htaccess file you need to paste this line of code after the rewriteEngine On line

RedirectMatch 301 ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ https://inteladesigns.com/$4

Then change the URL and paste your site’s URL.

 

To show the last updated date

4) function.php

For this option you may add this code to the function.php file in the theme folder.

 

// Load starting file.require_once trailingslashit( get_template_directory() ) . ‘includes/start.php’; function wpb_last_updated_date( $content ) {$u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_modified_time >= $u_time + 86400) { $updated_date = get_the_modified_time(‘F jS, Y’);$updated_time = get_the_modified_time(‘h:i a’); $custom_content .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;  }      $custom_content .= $content;    return $custom_content;}add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

 

This codes when executed shows the last day you updated the post long after publishing. Thus, when a reader gets to it, he/she will have confidence that the content is still fresh even with a backdated date of publishing. You may then go to the style.css form and write this code. Make sure you paste it into the current theme you are using.

 

.last-updated {

font-size: small;

text-transform: uppercase;

background-color: #fffdd4;

 

You may alter with this css code to make sure it matches your preference.

 

Conclusion

Make sure you don’t alter with the codes by pasting them on the wrong files. Therefore,  make a backup of the original files to prevent any alterations of the code that may cause an error.

You can also get to know more about how to use WordPress and starting a blog.

I hope this has been helpful.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Written by 

Trizah has been writing for Intela Designs for over four years. She provides content writing, coaching, web development, and ghostwriting services. Her educational background in website design and community development has given her a broad base from which to approach many technological topics. She has also written for Kenya News, We got it e-commerce site and independently on Upwork. She also enjoys embracing innovations, art and new designs :-) Twitter||Linkedin||Medium||Instagram