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

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:

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

    TO

    WHERE
    `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:

    From:
    =====

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

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

    WHERE
    `post_type` = ‘product’

    hope this helps for others.

Leave a Reply




Google PageRank