WordPress.org

Ready to get started?Download WordPress

Forums

Widget Default Values (3 posts)

  1. chuckmo
    Member
    Posted 3 years ago #

    I can't find any documentation for widget development that explains how to create default values for widgets that are created by extending the WP-Widget class.

    How do you set default values for new instances of your widget?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

  3. chuckmo
    Member
    Posted 3 years ago #

    Thanks for the link, but it looks like that just sets up the default values in the form. If the user doesn't then click the "save" button, those defaults won't be saved and the widget will still be configured with blank values.

    Is there any way to store default values without having the user save the widget? In the method used prior to 2.8, you could put the widget's defaults in the options table upon plugin activation.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags