Random number as permalink - Toolset

PHOTO EMBED

Wed May 11 2022 09:44:22 GMT+0000 (Coordinated Universal Time)

Saved by @Seb #php

function func_update_post_name( $post_id, $post ){
 
    if ( 'post-type-slug' == $post->post_type ) {
 
        remove_action( 'save_post', 'func_update_post_name',30,2 );
 
        // update the post slug
        wp_update_post( array(
            'ID' => $post_id,
            'post_name' => uniqid() 
        ));
 
       add_action( 'save_post', 'func_update_post_name', 30, 2 );
    }
}
add_action( 'save_post', 'func_update_post_name', 30, 2 );
content_copyCOPY

functions.php

https://toolset.com/forums/topic/random-number-as-permalink/