Skip to main content

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
1 answer
27 views

Do I need to validate the nonce when using the settings api?

I have been developing a plugin. When using the 'Plugin Check' Wordpress plugin to check it before submission, it gave me a warning that 'Processing form data without nonce verification.' Do I need to ...
dading84's user avatar
  • 101
0 votes
2 answers
32 views

the function do_settings_section($page) generate error "Allowed memory size of ... bytes exhausted"

I'm creating a plugin to auto delete post/event. I created a WP settings page to manage the default settings for auto delete. I followed each step to register_setting, add_settings_field and ...
imagIne's user avatar
  • 83
0 votes
0 answers
42 views

How can I use the WordPress Settings API to create a settings page for my plugin?

I am currently developing a WordPress plugin called FlexiPress. I've created a settings page in the WordPress dashboard where users can configure various features of the plugin. I initially used a ...
Alexis Grolot WP Pro's user avatar
0 votes
2 answers
24 views

When to store store plugin options as a single database record?

I'm building the analytics script plugin which offers customizations on a settings page. There will be around 20 options in total. Does it affect the performance negatively if I manage these 20 ...
Ostap Brehin's user avatar
1 vote
2 answers
44 views

What is the real purpose of the parameter $option_group in the function register_setting()?

We have the following register_setting() function from the Settings API: register_setting( string $option_group, string $option_name, array $args = array() ) I get what the $option_name and the $args ...
Gerard Reches's user avatar
0 votes
2 answers
73 views

Ignore "empty" fields when saving

My WordPress and PHP knowledge is limited, but I am working on a plugin, and in the admin page I have three settings - two text inputs and one checkbox. On save, the values are stored in the ...
mjlu's user avatar
  • 3
1 vote
0 answers
28 views

Hooking into button when using Settings API

I'm making use of the Settings API for a WordPress plugin. However, I want to perform some processing after the "Save Settings" button has been pressed (which I'm adding via the ...
dartiss's user avatar
  • 11
1 vote
1 answer
39 views

How to sanitize settings API value

I am working on a Plugin. I am using Settings API like below. register_setting( 'sports_api_key', 'sports_api_key' ); How can I sanitize settings API Text value here ?
abu abu's user avatar
  • 203
0 votes
0 answers
155 views

Transmit headers and footers via API from one site to another

I'm trying to have the same header and footer as my WordPress site on another site (that doesn't use WordPress) with a different domain and hosting. The manager of the other site wants it via API but ...
LesCa's user avatar
  • 21
1 vote
1 answer
30 views

Trouble with WordPress Settings API: Form Submits When Fields Called Directly, Fails When Using Callbacks

0 I'm working on a WordPress plugin and facing an issue with the Settings API. I have a settings page with two forms. The first form uses do_settings_sections() to call fields from a public function (...
user2765920's user avatar
0 votes
1 answer
32 views

how to test for options(fields) in settings API?

I've created an options page in wordpress with this code: <?php add_action( 'admin_menu', 'rtwhc_add_admin_menu' ); add_action( 'admin_init', 'rtwhc_settings_init' ); function rtwhc_add_admin_menu(...
rudtek's user avatar
  • 6,153
0 votes
1 answer
605 views

Tab Nav and WordPress Settings API

I created a settings page for my custom theme on WordPress and created the various metaboxes via Settings API. To try to keep the page neater I created Nav Tabs, the only problem is that I can only ...
Matteo Feduzi's user avatar
0 votes
0 answers
98 views

move setting data from wordpress api to codestar freamwork

I am coding a plugin that uses the Star code framework It should be mentioned that I had written this plugin using WordPress API before. Now I want to integrate and make it more advanced, but I ran ...
masoud nkh's user avatar
0 votes
1 answer
91 views

How to use register_setting()

When creating a settings page, each new settings field need to be registered individually with register_setting() or can I pass the slug from the setting section into it to register the fields?
JayDev95's user avatar
  • 179
0 votes
1 answer
64 views

Settings API not Saving to Database or Display

I am developing a payments gateway, and wanted to have a page with a form to save authentication credentials for reaching out to an external API used for payment. I made a settings page using ...
Evan Kirschenmann's user avatar
0 votes
1 answer
80 views

Update custom settings field in plugin

I have the code below for a simple Settings page for my custom plugin, where the user can enter their webhook URL. My issue is that when the user first enters a value and hits the submit button, ...
Jon Wright's user avatar
0 votes
0 answers
89 views

How to add custom settings to the menu of custom post types?

Not sure if this has been asked before. But how can we add custom settings to the menu of custom post types? Or add custom fields for an entire post type and you can edit them? For example: This is ...
Run's user avatar
  • 331
0 votes
1 answer
169 views

Should I escape the html for the settings field created with add_settings_field?

I am using a class that handles the output of WP settings fields. This class uses the function "add_settings_field" which receives as a "callback" parameter the name of the function that prints the ...
Giulia Rabita - Metup's user avatar
0 votes
1 answer
114 views

WordPress Settings API unable to save settings

So I can't seem to get the Settings API to save a field properly, I feel like I've followed ever single step, but I'm having no luck, so I wanted to reach out and see if someone might be able to spot ...
Sem's user avatar
  • 3
0 votes
0 answers
33 views

Theme Customizer performance drops when adding a lot of settings

I maintain a plugin in which we currently add ~730 settings to the Theme Customizer. We use a few custom controls for panels, sections and settings and loading the preview is a very painful experience ...
xxtesaxx's user avatar
  • 101
1 vote
1 answer
332 views

Is it possible to get a list of options for a specific options group?

When registering options in WordPress, you are required to supply a "settings group name" along with the name of the option itself. register_setting( string $option_group, string $...
soupmagnet's user avatar
0 votes
1 answer
38 views

Why aren't these WordPress options being saved to the database correctly?

I have a plugin for editing certain options already stored in the database. It creates an options page under Settings with a simple form that populates each field with whatever values are stored in ...
soupmagnet's user avatar
1 vote
0 answers
63 views

How to get specific setting by settings_fields()?

I am working on a plugin and on the settings page I have 2 settings and I want to show Only one setting "backgroundColor" so how should i do that? This is the code: <form action="...
kovrita is The life's user avatar
2 votes
1 answer
1k views

The Settings API - What is the purpose of default value in register_setting?

I'm trying to wrap my head around the Settings and Options APIs as I'm writing a simple plugin. One thing that has really stomped me is the possibility to add a default value to an option when calling ...
Tomas Eklund's user avatar
1 vote
1 answer
91 views

Displaying validation message in options-general.php

I have added a setting field in the general settings page. The field and the validation work, but the validation error message does not show. <?php add_action( 'admin_init', '...
jamomani's user avatar
  • 111
1 vote
1 answer
470 views

How to get bool with `get_option()` when already registered setting with type `boolean`

When I register a boolean setting using register_setting() I already pass the data type: register_setting( option_group: '…', option_name: '…', args: [ ...
David Wolf's user avatar
1 vote
0 answers
98 views

Settings API not saving values to database

Here is what I'm attempting to do: I have two fields called Client ID and Client Secret. I would like to save each individual item in the database as the following keys: instagram_client_id and ...
Sema's user avatar
  • 11
1 vote
1 answer
655 views

Saving plugin's settings in 1 field in json format

This is a question about performance. I've used the Wordpress Settings API in order to register fields and for a plugin that has 30+ fields that can cause a huge amounts of lines of code, in addition, ...
odedta's user avatar
  • 86
0 votes
1 answer
137 views

Multisite Equivalent of `register_setting`?

Working on converting a custom plugin to run in multisite. I want the settings to apply globally, not per-site. I've converted all of the get_option calls to get_site_option and the equivalent for ...
James K.'s user avatar
  • 101
1 vote
0 answers
48 views

How I can Make two input field at add_settings_section

How I can make two input fields in the add_settings_section? I want the First Input type to be text The second Input type is the Select option and Inside Foreach and here is an exmple: function ...
Ahmed java's user avatar
0 votes
1 answer
433 views

Settings API form - submit with AJAX

I'm creating a plugin where I have a dashboard that is done with Settings API. I'm trying to save data from that form via AJAX. Form: public function agy_dashboard_page() { ?> <form id=&...
upss1988's user avatar
2 votes
2 answers
664 views

Single sanitization callback for multiple fields

hope everyone is doing good! How can I have a single sanitization callback for multiple fields? Here is my code add_action('admin_init','settings'); function settings(){ add_settings_section('...
Shakti Goyal's user avatar
1 vote
1 answer
537 views

Settings API - sanitize_callback is not called and it leads to an incorrect behavior

I am in the process of creating some options / the options page for my plugin. In the context of this I have only added two checkboxes so far to store boolean values. The creation, display on the page ...
Sven Rösser's user avatar
0 votes
1 answer
76 views

Call require_once form admin page with checkbox

I'm creating a custom WP plugin. Inside my main plugin file (functions.php) I've includes the following line of code so a second file (module_2.php) with additional code will be loaded: define( '...
AartStaartjes's user avatar
0 votes
1 answer
584 views

how to save checkbox data for custom setting?

I am creating one custom setting panel, my codes are function custom_text_field_html(){ $text = get_option( 'homepage_text' ); printf( '<input type="text" id="...
Ricky's user avatar
  • 53
0 votes
1 answer
353 views

update_option_{$option} not working (do function after options are saved)

Below is my code for a simple plugin settings page. It works and saves an option ("EN", "CZ"). However, what I intend to do is run a function after the options get saved (see at ...
Kristýna Šulcová's user avatar
1 vote
2 answers
330 views

Add description to custom plugin setting

Using add_settings_field(); i am able to add my custom setting: add_settings_field('AUTOPLAY', 'Auto Play', 'printAutoPlayCheckbox', 'my_settings'); function printAutoPlayCheckbox() { $id = '...
TheDoctor's user avatar
  • 113
0 votes
1 answer
192 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 ...
Kristýna Šulcová's user avatar
0 votes
1 answer
1k 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 ...
Balessan's user avatar
  • 153
3 votes
1 answer
4k 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 ...
Álvaro Franz's user avatar
2 votes
1 answer
36 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 ...
Lois Hunt's user avatar
0 votes
1 answer
74 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() { ?> &...
Jlil's user avatar
  • 222
0 votes
0 answers
833 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 ...
blackbart's user avatar
1 vote
1 answer
2k 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 ...
Jon's user avatar
  • 323
0 votes
2 answers
262 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 ...
Syze Developer's user avatar
0 votes
0 answers
9 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 ...
Gui's user avatar
  • 1
1 vote
1 answer
666 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 ...
Mähnenwolf's user avatar
2 votes
1 answer
137 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() ...
Jonas's user avatar
  • 159
0 votes
1 answer
91 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 '...
Raashid Din's user avatar
0 votes
1 answer
217 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 &...
Michael's user avatar
  • 281

1
2 3 4 5
9