Skip to main content
1 of 2
hamdirizal
  • 483
  • 2
  • 7

You can filter the slug creation on wp_unique_post_slug hook.

//Register the filter
add_filter('wp_unique_post_slug','prefix_the_slug',10,6);

function prefix_the_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug){
    //Slug prefix, you can put Carbon results here.
    $prefix = 'my-awesome-prefix';

    //Adjust this to your post type
    if($post_type==='post'){
        return $prefix.$slug;       
    }
    return $slug;
}
hamdirizal
  • 483
  • 2
  • 7