Questions tagged [settings-api]

The Settings API, added in WordPress 2.7, allows admin pages containing settings forms to be managed semi-automatically. It lets you define settings pages, sections within those pages and fields within the sections. New settings pages can be registered along with sections and fields inside them. Existing settings pages can also be added to by registering new settings sections or fields inside of them.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

Settings API not saving

I've been through this code a hundred times and I just can't spot what's wrong with it. What it does: ✓ display options page, settings section, setting fields ✓ go through the sanitation function at ...
0
votes
0answers
44 views

Retrieve my custom settings in the settings/ API endpoint

I did read this post: Serialized settings in rest api and while I am actually convinced the answer is what I need, I cannot make it work. What I am trying to achieve is to get my own settings ...
0
votes
1answer
31 views

When should I use register_setting() and add_settings_field()

When the time comes that one wants to create a settings page, one stumbles upon two semantically similar WP functions called: register_setting() add_settings_field() I read the docs and am confused ...
0
votes
0answers
17 views

How to save array repeater field data in options api? [closed]

How can i save repeater field data in array in options API? i register a option name using register_setting() and adding settings field using add_settings_field() functions. But those is not taking ...
2
votes
1answer
24 views

Settings Page won't save

I've created a simple settings page with just one page, one section and two fields, it all displays just fine, but I can't for the life of me figure out why it won't save. There's either a typo or I'm ...
0
votes
1answer
17 views

Extend my plugin settings with hooks

I need to add a new options to my settings, the new filed shown in settings page but not saved. My add_settings_field callback: public function field_option_callback() { ?> &...
0
votes
0answers
20 views

Whats the best practise on how to store json data from a custom settings page?

I'm creating my first Wordpress Plugin and want to let the user configure multiple urls which he can name and safe as "channels". I've set up a settings page and wanted to store the data ...
0
votes
0answers
16 views

External API integration in WordPress

I have API URL where I have access key and token along with JSON format. Now I need help as to how to integrate it. My clients need his form leads directly into his API. Below is the code with the ...
0
votes
0answers
15 views

Save input and select field in a plugin as an array

So I have two settings fields (one input and one select) which are working perfectly. However I want to "merge" these two options to display them next to each other in one callback. I tried ...
0
votes
1answer
36 views

register_setting & add_settings_error validation issues with multiple fields

I've been trying to use the Settings API for the first time. I managed to piece together a working example but I'm stuck on how to make multiple input fields required. Right now I have an admin ...
0
votes
0answers
18 views

add_settings_error() not shown and settings validation not working (settings api)

I have an options page which is not added under the "settings" section, but via add_menu_page()/add_submenu_page() This page contains of html markup for my settings and at the end <div ...
0
votes
2answers
19 views

website is not loading home page (moving from one server to another server)

I have a wordpress site and i want same site with other domain name at same server. I moved all files and folders to new domains directory and also successfully moved database. My admin panel is ...
0
votes
0answers
12 views

can we store custom option field in custom data base table

Hi i just want to know can we store the value of a custom created option in my custom database table? If yes then how? do I need to edit register_setting() Here is my code i want to save this in table ...
0
votes
0answers
7 views

Is it possible to have a global parameter page which allows to configure other plugins in the same place?

I have a wordpress mu installation which brings together several different sites for clients and I would like to provide them with a settings page to manage the settings of other plugins. In short, I ...
1
vote
1answer
85 views

Callback is not called in add_settings_field() when passed as part of an array, but recognises that it's there. It's passed Class to Class using OOP

I am building a plugin, I created a new admin page and subpage, and inside that subpage, I want to add some Settings. That's why I'm building them using the Settings API. I am using Composer and ...
0
votes
0answers
23 views

When looping over the Settings API, only the last item of the loop is being shown, with no inputs

Alright, so. I am building a form with WordPress, (plugin) and want to loop over it as often as I want. I chose 10 to try it out. So no inputs have been shown, even after I have the proper arguments. ...
0
votes
0answers
26 views

add_settings_field() inline inputs and remove table format

I'm writing a personal plugin, and i'm using add_settings_field() to callback function that print inputs. It seems that wordpress add automatically all input int a table with class="form-table&...
1
vote
0answers
16 views

Performance of several get_option() calls

I am currently working on my first WordPress plugin. To save and output certain settings I use the native Settings API. Now the question arises, how performant are several calls of the get_option() ...
0
votes
1answer
15 views

Multiple checkbox doesn't work in wordpress settings api

I was creating a checkbox of roles n WordPress. I successfully generated them but the checked function doesn't seem to work. Also, it is throwing this warning. Warning: Illegal string offset '...
0
votes
0answers
244 views

Error: Options page not found in the allowed options list. After submission an OOP plugin

I am trying to develop an OOP base wordpress plugin. I am calling setting api from another class to menu class. while after submission showing "Error: Options page rashed_option_group not found ...
0
votes
1answer
13 views

Custom plugin: how do I call a PHP file if settings option is set to true?

I am making a custom plugin with various functions that do different things. I have created a settings page using the Settings API to save data to the options db. That works fine. Now I'm trying to &...
0
votes
1answer
20 views

Settings API: Setting default option via 'get_option' fails

All my options are stored in one array test_hs_options I have select list settings field ( test_hs_options['duration_months'] ) which stores the selected month (1-12). For this settings field, I would ...
0
votes
0answers
20 views

Sanitization and validation input fields - Settings API

I'm creating a plugin and I am a quite newbie. So I have difficulty to properly validate and sanitize input fields. This is my code: register_setting( 'wp_banner_settings_fields', '...
0
votes
0answers
13 views

Data passed to the Sanitization function is empty

The seemingly related question offered not much help except for the first answer saying it could be Nonce related, but it doesn't help in finding out how...? (neither do I understand the documentation)...
0
votes
0answers
20 views

Wordpress Settings API using angularJS

i'm trying to update Wordpress General Settings page with AngularJS with a $http.post $scope.update = function(genSet){ $scope.generalSettings = angular.copy(genSet); $http.post('options-...
0
votes
0answers
135 views

Warning: This page allows direct access to your site settings. You can break things here. Please be cautious!

I am currently developing a wordpress theme and it has 2 custom admin settings sub pages which is created with wordpress settings API. However, in first sub page i can apply settings and save without ...
0
votes
0answers
159 views

Update File using Settings API init_form_fields

I have an existing plugin(payment gateway for woocommerce) that goes about generating settings as follows: In the constructor, It does the following: $this->init_form_fields(); $this->...
0
votes
1answer
10 views

Is there a standard technique or API for getting the site header image?

There is this function: get_header_image() which can be called from within WordPress. Is there a way to access this externally, i.e. from the API? The use case might be a header for an external RSS ...
0
votes
2answers
157 views

How to save custom settings api fields with custom section fuction

I am creating wordpress theme on a single options page. I have customized the default do_settings_fields and do_settings_sections functions. my fields are displaying fine but when i am trying to save ...
0
votes
1answer
335 views

Wordpress theme options checkbox default checked state

I am developing a custom theme. I added a checkbox with the settings api. They all work except for the ones that are checked by default (checked="checked"). They do not save when they get ...
2
votes
1answer
98 views

Setting 'autoload' to 'no' with Settings API

I've looked at the Settings API codex page, https://codex.wordpress.org/Settings_API, and I can't find anything related to setting autoload to no for any options using the Settings API. Is there any ...
0
votes
0answers
21 views

Help to create the best plugin settings!

Can you help me about how to create the best WordPress settings for plugins? I have a custom setting page and I need to create some field with WordPress API. Actually I use this solution: https://gist....
0
votes
1answer
16 views

Wordpress theme settings not saving

I am trying to develop a theme. I am at the part of using the settings API. The code I use for the settings are as follows: In the example snippets I'm using variables to show the structure of my ...
1
vote
1answer
28 views

Settings Page - Option won't save in database

I created an option in the options table and I am trying to save data from a custom settings page but I isn't saving. Below is my code adding the the fields and sections as well as their respective ...
0
votes
0answers
41 views

WordPress Settings API Overrides My Previous Value

I have created the following custom menu page to save some data, I've included some repeatable fields inside the form. The problem that I have is that every time I click the submit button it overrides ...
0
votes
2answers
107 views

WordPress Settings API Repeatable fields

I'm trying to find a way to add repeatable fields inside a custom admin page that I've made. Code: /*WordPress Menus API.*/ function add_new_menu_items() { add_menu_page( ...
2
votes
1answer
120 views

Settings API get_option best practices

I have a lot of options in my custom theme and most of them are like: get_option('my_option')['depth']['more_depth'] as they are arrays. In order to write code in a "cleaner", more compact way I have ...
1
vote
1answer
84 views

get_option array value defaults and best practices

I have a custom options page. I have several sections of settings and some of them are even more closely related to each other so I decided to store them in arrays, seems more logical to me. It surely,...
2
votes
1answer
79 views

Custom theme options Radio inputs not saving

Why isn't the following option getting saved? Have been searching for quite some time and can't get it to work. Settings code: add_settings_section( 'aa_myoption_section', null, null, 'mypage-...
1
vote
1answer
20 views

Customize format of settings

I am adding some settings to the "General" settings page: add_settings_section( 'foobar_settings_section', 'Foobar Options', [$this, 'foobar_options_callback'], 'general' ); $fields =...
1
vote
2answers
705 views

Serialized settings in rest api

I have registered settings and need it to be showed in REST API. $args = [ 'show_in_rest' => true ]; register_setting('default_sidebars', 'default_sidebars', $args); When I save a single ...
0
votes
1answer
81 views

How to save Checkbox-Options in Plugin Options Page

First of all: I am really a newbie. So I used a template for my options page and tried to customize it (works pretty good so far). About my plugin: It creates to post types and some meta boxes ...
1
vote
2answers
30 views

WordPress setting with select - where is my mistake?

I have two option callbacks in my plugin, one with a ckeckbox and one with a select field. The first one is working perfectly, the second not. The select field doesn't save its value. I double checked ...
1
vote
2answers
32 views

Most efficient way to use classes to create admin pages using Settings API

I've built a class which creates admin pages with the Settings API. I'm trying to optimize it to run only where I need it. Most of the examples and tutorials I've seen say to instantiate it from the ...
2
votes
1answer
1k views

Get page slug in Admin menu

I'm trying to add a settings menu to my plugin, but within that menu, I can't get the 'page' slug. I'm basically doing something like this: add_action( 'admin_menu', 'MyPlugin_AddAdminMenus' ); ...
0
votes
0answers
69 views

register_setting not save checkbox

To understand the Settings API I'm creating a custom settings page for a custom plugin. I have some trouble to save the settings, I have a single checkbox to test if the code works well, but if I ...
1
vote
1answer
756 views

Implement toggle switch for theme options in settings API

I love to work with bootstrap for the forntend part of my projects, but this time I need to create a theme settings page to manage the activation of some template parts of a custom theme. I want to ...
2
votes
0answers
111 views

Callback function is being called twice

I have registered a setting, added a section in my plugin. Inside that section, multiple inputs (checkboxes) fields have been added using the add_settings_field method. This method has a callback ...
2
votes
1answer
35 views

What is the use of get_option method

I am a new learner of Wordpress plugin. recently I came across a method get_option(). When I pass the page parameter of add_settings_field() function then it outputs all the input fields (checkboxes) ...
1
vote
1answer
61 views

settings_fields doesn't appear to be running

I'm creating a settings page for a plugin. It adds: a submenu item registers a setting adds a section adds a field and then renders the page/section/field. It is all pretty straightforward, only "...

1
2 3 4 5
9