I have created custom post type and made the form to add custom fields in custom post using add_meta_boxes action.

actually in my custom post type i have employee_id which is next number in the sequence if we are adding new custom post type.

Now i have 2 question and i hope you guy don't mind answering me both questions

  1. How i know i am on edit custom post page or add new custom post page as if on edit i have to show existing employee id and if on add new i have to get next highest number in sequence?

  2. How can we add validation to custom fields and display error i.e if user set employee id empty we need to tackle it ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.