WordPress错误:在允许的选项列表中找不到选项页Setting_

时间:2020-10-19 作者:Jarda_H

我真的不知道现在该怎么办。:/我试过这样做:

add_action( \'admin_init\', \'Setting_\' );
这是我的字符串和表单设置:

function Setting_() {
    register_setting( \'options\', \'My_plugin_header_logo\' );
    register_setting( \'options\', \'My_plugin_links_facebook\' );
    register_setting( \'options\', \'My_plugin_links_youtube\' );
    register_setting( \'options\', \'My_plugin_links_email\' );
    register_setting( \'options\', \'My_plugin_links_instagram\' );
}

<form method="post" action="options.php">
  <input type="hidden"
         value="/wp-admin/options.php?page=my_plugin"
         name="_wp_http_referer">
  <p class="submit">
    <input id="submit" 
           class="button button-primary" 
           type="submit" name="submit" value="Save!">
  </p>
</form>
谢谢你的帮助!

1 个回复
SO网友:Jarda_H

Fixed!

 function Setting_() {
     register_setting( \'Set_my_options\', \'My_plugin_header_logo\' );
     register_setting( \'Set_my_options\', \'My_plugin_links_facebook\' );
     register_setting( \'Set_my_options\', \'My_plugin_links_youtube\' );
     register_setting( \'Set_my_options\', \'My_plugin_links_email\' );
     register_setting( \'Set_my_options\', \'My_plugin_links_instagram\' );
 }
    
 add_action( \'admin_init\', \'Setting_\' );
    
 settings_fields( \'Set_my_options\' );