WordPress.org

Ready to get started?Download WordPress

Ideas

Custom field Validation

  1. faboulaws
    Member

    Would be great to have custom field validation.An example would give a better idea .For example a meta box name "Contact" with the following fields
    -Email (email,required)
    -Fax
    -Phone (required)

    And the meta box shows only for the School post type.

    Posted: 4 years ago #
  2. Mark
    Member

    12345

    Plugin territory. The Custom Field Template plugin can already do some of this.

    Posted: 4 years ago #
  3. Justin Tadlock
    Member

    12345

    Plugin territory. You should be creating meta boxes using add_meta_box() and running a save/validation function on save_post.

    Posted: 4 years ago #
  4. avocado
    Member

    The problem with save_post is that it isn't called until after the post is saved. We need a validation hook to call BEFORE the post is saved, and a way to set error messages. Preferably without relying on javascript, which the plugins I've seen do.

    Posted: 3 years ago #
  5. transferkiev
    Member

    The add_meta_box() function was introduced in Version 2.5. It allows plugin developers to add sections to the Write Post, Write Page, and Write Link editing pages.
    http://codex.wordpress.org/Function_Reference/add_meta_box

    Posted: 3 years ago #
  6. avocado
    Member

    The add_meta_box callback doesn't seem to offer a way to cancel the save or display an error if the data is not valid.

    Posted: 2 years ago #
  7. uebersetzung
    Member

    We need a validation hook to call BEFORE the post is saved, and a way to set error messages. Preferably without relying on javascript, which the plugins I've seen do. The add_meta_box callback doesn't seem to offer a way to cancel the save or display an error if the data is not valid.

    Posted: 2 years ago #
  8. kevin7911
    Member

    Plugin territory.

    Version 3.0+

    http://codex.wordpress.org/Function_Reference/add_meta_box

    Posted: 2 years ago #
  9. s.holyszewski
    Member

    Will you people please read the original message before replying? The OP has repeated two or three times that they need to validate before saving, and you keep replying with the same solution that only ever calls your callbacks after the post was saved!

    What does "Plugin territory" mean?

    Posted: 2 years ago #
  10. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    You can't validate before you save in many situations, as there's no 'action' to trigger validation. unless you include JavaScript or Ajax checking, there has to be a 'thing' that says 'and now, we validate.'

    Plugin territory means this should be a plugin, not in core.

    Some of these replies are spam, however. Sorry about that.

    Posted: 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    10 Votes
  • Status

    This is plugin territory