• Resolved datdesignguy

    (@datdesignguy)


    Hi All,

    I’m building a theme with custom-options using Otto’s fantastic tutorial on the WordPress settings API as a basis for my custom theme options.

    I have registered a new setting: iblaunchy_options and all of my theme’s settings are stored inside of this option:

    register_setting( 'iblaunchy_options', 'iblaunchy_options', 'iblaunchy_options_validate' );

    I’m currently working on the validation function, and would like to be able to display errors on the options page if one of the options in my validation function fails to pass.

    I’m not sure how to do this. I read up on the codex for add_settings_error and settings_errors but am still unsure how to proceed.

    Has anyone come across a good explanation of how to use these settings api functions to display errors back to an options page built using the method in Otto’s tutorial?

    I’m just not sure how to show errors for these settings because they are nested within the iblaunchy_options setting.

    Any ideas?

    Thanks,

    Greg J

Viewing 1 replies (of 1 total)
  • Thread Starter datdesignguy

    (@datdesignguy)

    I figured out how to achieve this. After a few searches, a few failed attempts, all that was missing was a call in my options page template to settings_errors and the manner in which I addressed my settings themselves in the call to add_settings_error.

    This post on WP stackexchange was skooper helpful in solving my problem.

    Also this post on WP Engineer inspired the example I’ve pasted below (the only difference between my example and theirs, is I show you where to insert the call to show_errors… theirs is far more thorough)

    Here’s a code example from start to finish: http://pastebin.com/K4kJ0DNG

Viewing 1 replies (of 1 total)
  • The topic ‘how to use add_settings_error() for nested options array’ is closed to new replies.