register_setting无效! [英] register_setting is not working!

查看:283
本文介绍了register_setting无效!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计,

有一点问题,register_setting不起作用,实际上它不是在options.php中添加选项

这里是代码换行class和hook with admin_init function。



Hi Folks,
there is a bit problem with register_setting is not working, actually it''s not add option in options.php
here is code wrap in class and hook with admin_init function.

public function as_themeFunction(){
    register_setting('as_theme_settings','as_theme_settings',array($this,'dataValidation'));
    add_settings_section('as_theme_section','Theme Settings',array($this,'as_theme_setting_section'),'theme_options');
    add_settings_field('as_theme_field','Theme Background',array($this,'as_theme_background_input'),'theme_options','as_theme_section');
    //Working Here
}







这里与admin init挂钩






here hook with admin init

add_action(''admin_init'',''themeAdminInit'');
function themeAdminInit(){
	$themeSetupClass = new themeInitialClass;
	$themeSetupClass->as_themeFunction();
}

推荐答案

this,' 资料验证));
add_settings_section(' as_theme_section'' 主题设置',数组(
this,'dataValidation')); add_settings_section('as_theme_section','Theme Settings',array(


this,' as_theme_setting_section'),' theme_options' );
add_settings_field(' as_theme_field'' 主题背景',数组(
this,'as_theme_setting_section'),'theme_options'); add_settings_field('as_theme_field','Theme Background',array(


this,' as_theme_background_input'),' theme_options'' as_theme_section');
// 在这里工作
}
this,'as_theme_background_input'),'theme_options','as_theme_section'); //Working Here }







这里与admin init挂钩






here hook with admin init

add_action(''admin_init'',''themeAdminInit'');
function themeAdminInit(){


这篇关于register_setting无效!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆