I am working on a custom post type, I have removed all the standard wordpress form items and started from scratch with custom meta boxes, except the title field.
In my situation, it is really important that some of the custom meta dropdown selections be selected.
Is there an easy solution to make it where they must select some items before they can post the item?
I assume javascript would be the easiaest solution but it would be nice to let the user know what is going on, like highlight the box if they try to post and it isn’t selected yet, another issue is with a drop down menu, there is by default a value selected already even if they did not pick one
You can use jQuery as it already loaded on posts. The idea is to stop the form submit action.
I have two html elements in my meta:
The form has an id of “post”. So with jquery we can write:
I think that should do it. To add javascript on a post page use admin_init hook and wp_enque_script. search for them in the codex and you will find out how to use them. if not post a new question.