Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [add-settings-field]

The tag has no usage guidance.

21
votes
2answers
35k views

Add multiple custom fields to the general settings page

What I would like to do is to add a few custom fields to the general settings. This is the code that I'm using. It works alright but I just cant figure how to add more fields. I would like to create ...
13
votes
1answer
11k views

How to pass arguments from add_settings_field() to the callback function?

I have a function like this: add_settings_field( 'contact_phone', 'Contact Phone', 'settings_callback', 'general'); That works. It calls settings_callback. Cool. The problem I have with this is: ...
6
votes
1answer
2k views

Settings API - adding setting fields dynamically?

Is there a way of adding settings fields dynamically? I have my own Settings API options generator just like in Chip Bennet's Oenology Theme, everything works perfect but I can't find a way to create ...
5
votes
1answer
2k views

Settings API - creating reusable form elements?

I have a set of settings fields: (...) add_settings_field( 'Option1', 'Option 1', 'textarea', 'page1', 'plugin_options'); add_settings_field( 'Option2', 'Option 2', 'textarea', 'page1', '...
5
votes
2answers
1k views

Settings API - changing add_settings_field() output?

I'm using Settings API and wondering if there's any way of editing default output of add_settings_field() function? add_settings_field('the_field', 'bar', 'foo', 'page', 'section'); function ...
5
votes
1answer
2k views

Default value for add_settings_field

I'm creating a simple settings page by following these instructions. Since this is a custom plugin, I'd like one of my settings to start with a predefined value (that can later be changed). What is ...
4
votes
2answers
4k views

Add your own settings page for plugin

I'm using the Wordpress Plugin Boilerplate to make a plugin and I'm having some trouble outputting a form for users to input configuration options for the said plugin. I have the following methods ...
3
votes
1answer
807 views

Theme customizer: How do you grab the value later?

I'm working on a custom site, doing all my work in a child theme. I need to add one variable, slider speed, to the customize control system. I've been able to modify the custom controls via the ...
2
votes
1answer
2k views

How can one utilize a variable as a callback function name for add_settings_field

I'm trying to cut down on the amount of code that is in my theme options function. I'm adding my settings like so: add_settings_field($k,$v,$callback,$the_options,$the_group,$args); This works for ...
2
votes
1answer
1k views

settings API: how to create a multi checkbox with blog categories?

i need to create a callback function with a multi checkbox with all the web/blog categories as multi options. my add_settings_fields are: add_settings_field( 'select_page', ...
2
votes
1answer
124 views

Settings API - generating field value based on a different field?

I store my themes settings using Settings API. If I create a new setting using add_settings_field() is it possible to create another setting that will be based on the first one? Why? Imagine I have ...
2
votes
0answers
379 views

Letting user dynamically create fields using Settings API

I created a settings page, using the Settings API, following this tutorial. Now I want to have a button that lets users dynamically add fields, similar to the way it is done in this other one. I don'...
1
vote
1answer
1k views

site identity section name?

In the customizer, the site identity section is missing a logo upload field. Adding such field is not a big deal: A field can be added, but I don't know the section name that is created in the core of ...
1
vote
1answer
66 views

Why this global array is returning NULL from a callback function

This drove me crazy for hours now... Please tell me why the $ppk_fields array is empty in the ppk_field_callback function? Note that it returns the correct values in the ppk_default_id function but ...
1
vote
3answers
3k views

Plugin set default setting value when it activated

I have set up my plugin option on admin panel with /** * Register and add settings */ public function page_init() { register_setting( 'my_option_group'...
1
vote
1answer
2k views

Multiple fields with add_settings_field callback

I have a settings page where I am creating a UI that changes column widths for a layout template. To customize this on my settings page I am using do_settings_fields for output and add_settings_field ...
1
vote
1answer
342 views

Wordpress API Setting : the title of the section rendered not showing

Please see the below-mentioned code → function klogeto_initialize_theme_options() { // Let's introduce a section for the header options add_settings_section( 'header_section', ...
1
vote
1answer
34 views

Two Types of settings in WP - The Doubt

I was trying to learn some basics of wordpress plugin development, and I stumbled upon two types of settings. 1 add_settings_field( 'custom_title', esc_html__('Custom Title', 'myplugin'), ...
1
vote
1answer
134 views

Sections and tabs DRY - WordPress settings API

I have made a custom setting page containing 3 settings sections under 3 tabs. However I am a total noob when it comes to PHP and I feel like I have written a lot of unnecessary, repeated code. My ...
1
vote
2answers
449 views

Extend plugin options page

I had recently installed Post Views Counter plugin, which created an options page under the Wordpress Settings menu. Now, I'd like to extend plugin functionalities by adding few more options. It will ...
1
vote
0answers
263 views

Move Custom Fields on General Settings Page to New Location

I've created some custom fields on the General Settings page after studying up on this post: Add multiple custom fields to the general settings page. I'd really like to move them to their own ...
1
vote
0answers
136 views

Settings API: Change position of custom setting field

I've searched high and low on Google and this site for an answer to this and am quite surprised to find nothing about it anywhere I've added a custom setting to the General settings tab using ...
0
votes
1answer
1k views

Single callback with multiple setting fields

Is there anyway you can use a single callback with multiple setting fields? Maybe there is a way to pass the setting field used through the callback?
0
votes
2answers
290 views

Section Name for Menu in Theme Customizer

I browsed many articles to know the section Name of the "Menu" in the theme customizer. Here are the few resources that proclaim and identifies that the default section name is "nav" → https://...
0
votes
2answers
63 views

Can I use register_settings and unregister_setting once the settings page has loaded?

I want to add few settings fields dynamically on settings page depending on user action. I am planning to register these new fields dynamically once user asks for it and show the corresponding HTML ...
0
votes
1answer
42 views

Theme Customize API Panel Concept

I am assuming while writing this post that I have a clear understanding of the theme customizer API: There are sections → Under which we have Panels → and under these panels we have Fields. I am ...
0
votes
1answer
23 views

Settings API and 'type' => 'font'

array( 'name' => 'textarea', 'label' => __( 'Textarea Input', 'wedevs' ), 'desc' => __( 'Textarea description', 'wedevs' ), 'placeholder' => __( '...
0
votes
1answer
784 views

How to save plugin custom settings page fields

I want to implement a plugin which gets 2 fields in admin area and saves those in options as array I read the page Custom Settings Page but seems it doesn't describe how to save fields values in ...
0
votes
3answers
286 views

General Settings: display custom plugin field after Site Address field

For my custom settings field, I am looking to insert it right after the Site Address (URL) field in the General settings page. I'm able to add the custom field sucessfully using the ...
0
votes
1answer
237 views

Use the Settings API to whitelist a setting, but don't output it

I have a plugin page with several settings. Four of this settings, all in the same section, need to be displayed inline rather than one above the other. However to ensure the settings are whitelisted, ...
0
votes
1answer
467 views

add_settings_field (exclude categories->reading) wp_category_checklist

In settings/reading, I'm trying to add an option to exclude one or more post categories from main posts/home page. I'd like to utilize the wp_category_checklist function to create the new settings "...
0
votes
1answer
139 views

Cloning add_settings_field() with jQuery

Is it possible to setup one add_settings_field() in an options backend and then use jQuery clone function on the front end and be able to create multiples of whatever and save that in an array? I've ...
0
votes
1answer
228 views

esc_url not working within add_settings_field callback

I'm trying to display a saved option of a url inside a text input on my themes' options page, but it's just simply not displaying. I've checked the database and my url is saved using the specified ...
0
votes
0answers
20 views

add_settings_field on permalink page

I'm trying to add settings fields on the permalink page. For some reason, it's the only page that doesn't save the settings. To reproduce: <?php function add_settings_permalink() { ...
0
votes
1answer
28 views

Problem with checkbox in Settings API

I am trying to create a simple checkbox setting that toggles a section in a blog post on or off in a theme settings page. Unfortunately it's not saving the checkbox setting. I check the box and when ...
0
votes
0answers
16 views

Wordpress theme custom Settings Section

i am trying to add a custom settings in my wordpress theme. Codes are below. only add_settings_field callback function is not working. anybody have any idea whats wrong?? main menu code is below: ...
0
votes
2answers
281 views

Plugin setting page - update_option problem

I am new to plugin develop and I have a problem with settings page of my new plugin. My page seems to save correctly settings data to wordpress database, but after a few hours/days value stored on ...
0
votes
1answer
129 views

Customizer settings using “for” loop

Please let me know if I'm missing something here - I try to create multiple customizer settings using for loop, they don't show up in the customizer though. Here's the code: for ( $i = 1; $i < 7; $...
0
votes
2answers
619 views

add_settings_error on validating plugin options API

I am developing a plugin which uses options API. I defined a class that uses a function to sanitize the inputs, but when I submit the options form, It displays errors and info twice. And also I didn'...
0
votes
2answers
1k views

Add two input fields in add_settings_field

I want to add a third column consisting of an input textfield using the Settings API. Is this possible? function print_custom_field() { $value = get_option( 'my_first_field', '' ); $...
0
votes
1answer
1k views

Extend WP_Customize_Control with Multiple Field Control

I'm trying to figure out how to code a custom control but frustratingly all the information I find online points to the same example of creating a single textfield. I'd like to create a custom ...
0
votes
2answers
106 views

Best place to store company address

Ok I'm creating a site for a company, this company will have multiple users. In the footer I am trying to include the company name, phone and address but not as a widget. I need to store the ...
0
votes
1answer
639 views

Adding Form Fields with Settings API

I'm making a plugin with an administration page witch uses the Settings API. I could make one section and one option. But how can I add other form fields to it? If I add an input tag to the callback ...
0
votes
1answer
88 views

How can I save a setting field with multiple checkbox options generated by a foreach loop on a custom wordpress admin page?

function ld_reports_plus_register_submenu_page(){ add_submenu_page( 'ld-reports-plus', 'LearnDash Reports Plus Settings', 'Report Settings', 'manage_options', ...