Categories: Snippets

How to change the WordPress permalink structure to remove dates from the URLs

Switching the permalink structure from /year/month/post-slug to just /post-slug is easy by going to Settings > Permalinks and choosing “Post name”:

But you don’t want any links to your old URLs to end up generating a 404, negatively affecting SEO.  To fix this you’ll want to add in a redirect into your .htaccess file similar to:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://yourwebsite.com/$3

 

Recent Posts

Adding or Including custom post type to default WordPress loop

Adding or Including custom post type to default WordPress loop by altering the 'pre_get_posts' function.…

6 years ago

How to Limit or Disable WordPress Post Revisions

Limit the number of posts revisions that WordPress stores in the database. edit wp-config.php file…

6 years ago

Multisite – List Recent Posts Across an Entire Network

In Multisite, List Recent Posts Across an Entire Network by using custom query or WP_Query…

6 years ago

Disable update notification for individual plugins / All

code for the plugin file itself:- [crayon-67a5ae627f7cb249009462/] I like to put this in the actual…

6 years ago

Limit character in content and title in wordpress

[crayon-67a5ae627f871317875136/] or with readmore [crayon-67a5ae627f873265774908/]  

6 years ago

Hide page visual editor if certain template is selected

[crayon-67a5ae627f90e511954996/]  

7 years ago