My plugin on a special projects custom post type admin add/edit screen requires to have the post ID.

When on this CPT admin add/edit screen I would like to get the ID in PHP if it exist already. If the post is new and does not yet have a Post ID, then I would like to save the post automatically to generate the Post ID right away.

How can I achieve this?


While clicking ADD-NEW (i mean when creating new post), it has already assigned an ID. You can catch it using javascript,like:


or catch it using PHP:


and see the variable name

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.