最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Arrays not working in my add_options_page

programmeradmin1浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论