Adding Mass Post Slugs (2 posts)

  1. cent
    Posted 7 years ago #


    We recently moved a site from an old legacy blog app to WordPress. The old system didn't use post slugs which was fine as we were using ?p= for permalinks. Now that we want to move to cleaner permalinks like /%year%/%month%/%title%, we need to go back and add post slugs to a few hundred posts.

    I couldn't find a WP plugin which will do this. We could potentially write a PHP script to do this for us but was wondering if there was something already available?

    Also, if we go down the custom route, one question. If a post from 1-1-06 has a title of "my blog post" and a post from 8-1-06 has the same post title, I assume WP will be able to know the difference based on the month/year? Also if there are 2 posts in the same month with the same title, is it customary to just add a number at the end?

    Thanks in advance.


  2. stvwlf
    Posted 7 years ago #

    You can see how WP calculates a unique slug in function wp_unique_term_slug() in file /wp-includes/taxonomy.php

    You can probably use some of the existing routines in that file in your scripts instead of starting from scratch

Topic Closed

This topic has been closed to new replies.

About this Topic