Hello, I was following this topic about autoincrement custom field, I was able to customize it and make it work but there is only one problem, it does not work when I add a new post from the parent post editor.
Suppose I have two related custom types: A, B
If I create an A post, and inside the A post editor I create a related post B, the autoincrement custom field does not work, I need to go to post B editor page to update in order to autoincrement the custom field value.
I think this hook does not work for me because I need to retrieve the post_type of the newly created post. This hook does not provide the newly created post_id but it provides both parent_id and child_id so I can't know which one is the newly created. It works only if I go through both parent post and child post.
To check why the hook you shared is not working I'll require admin access details and to what post type you want to apply the hook.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've one to many relationship created between post type student and student-reviews.
I've added the following save_post hook for student-review. When I try to create a new student review from post-relationship box when editing a single student from backend, when I try to create new student review, I can see that the following hook is called.