How do you make custom fields required before publishing?

Hello,

I was wondering if there was a way to make custom fields required before publishing a post?

My assumption is having to do some sort of jquery validation on the fields.

I would love to hear your opinions and options!

Thanks!

  • DavidM
    • DEV MAN’s Mascot

    Hi jacorre,

    That's a really good question, one I haven't considered myself, as yet. Looking at the Magic Fields changelog, I can see there's some validation occurring there regarding custom fields.
    http://wordpress.org/extend/plugins/magic-fields/changelog/

    I imagine you could either use that as a guideline for providing your own validation or perhaps even use the plugin for your custom fields. I've not yet tried it but it seems viable.

    -David

  • jacorre
    • Design Lord, Child of Thor

    Thanks David. I can try poking around that plugin file and see if the validation is what I'm hoping for.

    Even with normal Wordpress posts, there doesn't seem to be any required fields. I was thinking that the title would be the most important since it creates the url for the post. So I didn't put any title in and it uses the post id as the url instead!

  • DavidM
    • DEV MAN’s Mascot

    Yeah, it's funny that before having read your thread here, I didn't realize there really are no required fields.

    Really, I think it helps new users, as they don't have to fill in certain fields in order to create new posts, but they can more easily experiment with everything that way.

  • jacorre
    • Design Lord, Child of Thor

    I definitely agree with your point, but since WordPress can also be tailored toward a content management system, and if you have users that can submit posts, it would be beneficial to control the input before publishing.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.