How to mass change article slug urls in WordPress

This piece of PHP code will mass change your WordPress slug links to default slugs WordPress would normally generate from your article titles.

Open wp-config.php, add the following at the bottom:

Save and upload your new wp-config.php and load your home page only one time. Once the loading is completed, remove the code from your wp-config.php file.

Credits: Clorith @

Date: May 08, 2013

Filed Under: Web Development

About the Author: Computer Repair, Freelancer, Blogger, Reviewer and all around nice guy!

  1. Mark says:

    Thank you for the code. Worked well on my custom posts by changing:

    `post_type` = ‘page’
    `post_type` = ‘post’


    `post_type` = ‘custom-post-type’

  2. Max says:

    This saved my day, thanks.

    For those wondering, it works like a charm even for translated posts (at least if using WPML).

  3. kaboky says:

    Thank You So Much!!! Worked Like A charm!!!

  4. Avo Sarafian says:

    This really worked like a charm!… perfect!…

    for those who are dealing with WooCommerce products *only*, such was my case, change the following code:


    `post_type` = ‘page’
    `post_type` = ‘post’

    To become:

    `post_type` = ‘product’

    hope this helps for others.

Leave a Reply

Google PageRank