WordPress.org

Ready to get started?Download WordPress

Forums

Mandatory and validated custom fields (3 posts)

  1. niska
    Member
    Posted 6 years ago #

    I want to add several custom fields to my posts. I want them to be mandatory. Also I want to be able to validate each field.

    Example: Each post should have a version number and a URL poiting to a zip file. I want to verify that the version number doesn't have any space. Only digits and dots are allowed. The URL should start with "http://" and end with ".zip"

    If any value is incorrect the post should not be saved.

    Is there a plugin that can handle mandatory and validated custom fields? I've only found the Custom Field GUI which doesn't solve my problem.

  2. richarduk
    Member
    Posted 6 years ago #

    No idea if this will do it, but HeadSpace 2 from Urban Giraffe is highly thought of

  3. niska
    Member
    Posted 6 years ago #

    HeadSpace2 found at http://urbangiraffe.com/plugins/headspace2/ did not solve my problem.

    I need a very simple plugin that validates custom fields. I would like to be able to configure using key - value. Like this:
    'url' => '/^http:\/\/.+/'
    'image' => '/.+\.(png|jpg|gif)$/i'

    If the user adds a custom field with the name 'url', then a check against the regular expression is made to see if it's valid.

    I also need a simple plugin that is configured using a list of mandatory custom fields. Like 'url' and 'image'.

    Any ideas of how to do this?

Topic Closed

This topic has been closed to new replies.

About this Topic