Wp Undefined Function Add_Settings_Section
I'm Trying to Add Sections and Fields to a New Settings Page I Wordpress. but I Get the Response "Call to Undefined Function Add_Settings_Section(). ..". Does...
I'm trying to add sections and fields to a new settings page i WordPress. But I get the response "Call to undefined function add_settings_section()...". Does anybody know why that is? This is the code in question: add_settings_section( 'ac_div', 'Inställningar', 'ac_section_text', 'Anders-counter' );
add_settings_field(
'diven',
'För in mätarställningen här',
'ac_add_field',
'Anders-counter',
'ac_div');
Thankful for help. Anders
1 Answer
add_settings_field function located under wp-admin/includes/template.php
you can load that file before calling add_settings_field, or simply add your code under admin_init hook
add_action('admin_init', 'your_function');
function your_function(){
add_settings_field(
'diven',
'För in mätarställningen här',
'ac_add_field',
'Anders-counter',
'ac_div'
);
}