• Resolved dedrago

    (@dedrago)


    Hi @mateuszgbiorczyk and thank you for your awesome plugin!

    I have my custom function which generates some new posts from json every day. I used your plugin to change slugs to something like this mainurl.com/base/country/state/city/post. However your plugin changes links only when I hit “save” button in the plugin settings. Could you please give me an advise on how to automate the process? Maybe there is a way to pre-rewrite the slug for specific custom post type or add rewrite action to my function.

    Thank you in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter dedrago

    (@dedrago)

    If someone will need to update post slugs automatically after import just add this function after your import.

    
    function my_update_posts() {
        $args = array(
            'post_type' => 'job_listing',
            'numberposts' => -1
        );
        $myposts = get_posts($args);
        foreach ($myposts as $mypost){
            wp_update_post($mypost, true);
        }
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Auto update slugs’ is closed to new replies.