I have a custom post type film review. I use metaboxes on the admin screen (see screenshot).

enter image description here Some of the fields are required (marked *).

I want to add the following functionality: If the user didn't fill out the required fields, the cpt is saved as draft. This part works well so far.

Then a notice should be shown informing the user that some required fields are not filled and also that the review is saved as draft instead of being published instead of the notice "Filmkritk veröffentlicht" as in the screenshot.

I have add a hook to admin_notices in the save function but it doesn't work. I have seen that after publishing the url has a parameter message which has a numeric value e.g.http://programmkino.local/wp-admin/post.php?post=3027&action=edit&message=6 but I could not figure out where it is set.

Any suggestions how I could archieve this functionality?

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.