plugins - Arrays not working in my add_options_page

I'm customizing my own options page for a plugin and I have a very basic question about arrays that I'm attemp

I'm customizing my own options page for a plugin and I have a very basic question about arrays that I'm attempting to input in my add_options_page under the $function. My code looks like this:

function myplugin_register_settings() {
    add_option('myplugin_option_name', 'Option Value');
    register_setting('myplugin_options_group', 'myplugin_option_name', 'myplugin_callback');
}
add_action('admin_init', 'myplugin_register_settings')

function create_plugin_settings_page() {
    add_options_page('Page Title', 'Plugin Menu', 'manage_options', 'myplugin', array( $this, 'plugin_settings_page_content'));
}
add_action('admin_menu', array($this, 'create_plugin_settings_page'));

function plugin_settings_page_content() {
    echo 'Hello World';
}

Unfortunately when I remove the arrays my code works perfectly. I'd like to keep them included because I'm looking to input a text field that saves to the database. Anyone help me?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744747651a4591400.html

相关推荐

  • plugins - Arrays not working in my add_options_page

    I'm customizing my own options page for a plugin and I have a very basic question about arrays that I'm attemp

    21小时前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信