01 02 03 04 05 06 07 08 09 10 11 | add_filter( 'wp_unique_post_slug' , 'custom_unique_post_slug' , 10, 4 ); function custom_unique_post_slug( $slug , $post_ID , $post_status , $post_type ) { if ( $custom_post_type == $post_type ) { $post = get_post( $post_ID ); if ( empty ( $post ->post_name) || $slug != $post ->post_name ) { $slug = md5( time() ); } } return $slug ; } |
Specify $custom_post_type to make it work for a specific post type.