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. https://stackoverflow.com/questions/4518527/customize-the-auto-generation-of-post-slug-in-wordpress