Hi all!
I have written this plugin for a sport club where you can book tennis courts; the idea is to give the admin the possibility to "manual add" new booking.
To do that I created a custom post type called "booking", when the admin will click on "add new" I'd like to see the "title box" of my cpt auto-filled with a unique code or incremental id that will identify that booking.
Which is the best way to generate a title/code like that?
If I have two people logged with the same admin credentials will be there collapse problem in the code generation?
function change_mycpt_default_title() {
if( $_GET['post_type'] == 'booking' ) {
return 'UNIQUE CODE HERE';
}
}
add_filter('default_title', 'change_mycpt_default_title');
This is the code I use to change the default title of my cpt.