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 @ https://github.com/Clorith/wp-slug-update

Published by

Ryan Kessen

Computer Repair, Freelancer, Blogger, Reviewer and all around nice guy!

4 thoughts on “How to mass change article slug urls in WordPress”

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

    WHERE
    `post_type` = ‘page’
    OR
    `post_type` = ‘post’

    TO

    WHERE
    `post_type` = ‘custom-post-type’

  2. This saved my day, thanks.

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

  3. This really worked like a charm!… perfect!…

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

    From:
    =====

    WHERE
    `post_type` = ‘page’
    OR
    `post_type` = ‘post’

    To become:
    ==========

    WHERE
    `post_type` = ‘product’

    hope this helps for others.

Comments are closed.