It is essential to have optimized and straightforward links to 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 remain. 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 the 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]+)/(.*)$ http://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>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’; } $custom_content .= $content; return $custom_content;}add_filter( ‘the_content’, ‘wpb_last_updated_date’ );
These codes when executed show 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 this CSS code to make sure it matches your preference.
Conclusion
Make sure you don’t alter 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 start a blog.
I hope this has been helpful.