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
0answers
553 views

Can't save multiple sections on one page with register_setting

I try to write my first own theme but currently I struggle with making the options with the Settings API. My input values are just not saved and I don't know why. I read this tutorial from Tom ...
3
votes
2answers
4k views

How to handel multiple checkbox field in the admin settings page with Settings API

I'm trying to incorporate a list of checkbox in my plugin's admin settings page from which users can select a few countries from the list of all countries. So far I've done this: add_action( '...
0
votes
3answers
540 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
98 views

How is a widget supposed to reference what is added to custom submenu or addmenu fields?

Stepping into advanced plugin development I've been following along with the Plugin Handbook but I did not see it mentioned how you're to reference what has been added to the settings page. So for ...
2
votes
3answers
1k views

Settings API - Undefined Index when unchecking checkbox

I know this may be a duplicate however I haven't been able to make sense of previous questions. I have a checkbox on a settings page. Everything is okay on the first load of the page, if I check the ...
1
vote
3answers
1k views

Hide output of add_settings_field()

The output of the settings API's function add_settings_field() is this: <tr> <th scope="row">Your title</th> <td> Your field output </td> </tr> I know I can't ...
2
votes
1answer
4k views

Add custom content in user-edit.php page

When I go to edit a user's account located in: http://web.site/wp-admin/user-edit.php?user_id=ID I want to add a custom section with my own information (just text), similar to the ...
1
vote
0answers
98 views

Wordpress Settings api data not sanitized if i use ajax

I have a phone number field on admin page that i have created using settings API. I have specified a sanitization function that removes everthing from the input except for numbers. Now if i submit the ...
2
votes
1answer
741 views

Add a Custom Permalink option in the Permalink Admin Screen?

My plugin has several custom post types and the main one I want to make its permalink slug changeable. I would prefer to keep things clean and add that option in WordPress' Permalink admin screen, ...
3
votes
1answer
2k views

Custom plugin settings: clicking “save changes” does not display success message

I don't entirely understanding how to save my plugin's settings properly. When I click on the "Save Changes" button it saves data but it does not show any successful like message. Do I need to add an ...
2
votes
2answers
378 views

How to: add option to add more checkboxes on custom post type

I have created a custom post type where in one of the metaboxes I have checkboxes where author can select what he would like to add on the post. Now, if the author wants to add something that is not ...
0
votes
1answer
1k views

How to make new plugin setting checkbox default as checked

I have created a new plugin setting in an existing plugin that needs to be checked by default when users update to the new version because a lot of the original features are now activated by this ...
0
votes
1answer
92 views

How to Modify My Plugin's Admin Settings so that the Plugin can be Added to a Specific Page?

I have written a registration plugin for a very specific use case. The form contains several hundred lines of HTML. The intent for the form is to be able to add it to a given page by way of Admin ...
0
votes
1answer
493 views

Plugin options page: grouping checkboxes

I've been using the WordPress Option Page Generator by Jeremy Hixon to help give me a head start with my plugin's option page. I've laid out four different types of checkboxes which the source code ...
2
votes
2answers
11k views

Add Settings to Custom Post Type

I have a custom post type called Portfolio. It is associated with three custom taxonomies. This is all working fine. For the archive page, however, I need to add a few custom settings. Due to a ...
2
votes
2answers
214 views

Settings API - input always updates over validation

I am following a Wordpress book and am trying to create a plugin and have got an option page showing. In this page I have two text fields (which values are stored in one array). I am trying to add ...
0
votes
1answer
2k views

How to add a secondary button to a settings page with a custom action?

I have written a plugin that interfaces with a third-party mailing API. I have created a settings page for my plugin that includes two buttons: a submit button created with submit_button() which ...
1
vote
0answers
49 views

Allow users to add / remove settings in plugin

I have created a plugin for a client of mine that I think could help a lot of people out there, so I'm in the process of "generalizing" it. Right now, I'm using the Settings API and textareas in ...
2
votes
2answers
3k views

register_setting sanitize callback $input is null

I am struggling to get my settings page to save my options. I've got it showing up correctly and it hits the sanitize function register_setting( 'my_options', // Option group '...
1
vote
1answer
285 views

null callback in add_settings_section

Some code I'm looking at from a Plugin contains this line add_settings_section("section", "Settings", null, "theme-options"); which has a null callback. Having looked at https://codex.wordpress.org/...
2
votes
0answers
153 views

Correct way check nonce (security) using old Options API

I am developing plugin for Wordpress. Firstly I started using Settings API it looks good, but it is little bit complex and it doesn't provide the way to handle options manually. I have quite ...
9
votes
3answers
9k views

Where to store plugin settings fields

I am developing plugin right now, and I have one questions about best practices and conventions. What I need ? My plugin is going to store some predefined object, list of objects (or just ...
1
vote
2answers
2k views

Update problem with update_option() in combination with register_setting()

Intro I have a settings page which includes a setting with a more complicated callback function to save. Save data To save the data I use the register_setting() function with a custom sanitize ...
-1
votes
1answer
1k views

Where to adjust presets for slider options “auto rotate” (3, 5, 10, 15 seconds)? [closed]

I’m currently helping somebody out with their wp installation – and we’re a bit puzzled with the presets for a slider / corousel. The theme in use Stockholm, featuring the Visual Composer plugin. In ...
2
votes
1answer
468 views

How do I save custom options on the options page 'Reading'?

I want to add some options to the default "Reading" options page. The code I have is: add_settings_section("section_share", __("Sharing & Publishing", "honeycomb-wp"), __NAMESPACE__."\\...
2
votes
1answer
830 views

When should I call add_settings_section and add_settings_field?

All of the examples I've seen for add_settings_section & add_settings_field have them being called on the admin_init action. This means that they're being called when loading every single admin ...
0
votes
1answer
435 views

Wordpress modify Settings > Permalinks (options-permalink.php) Add CPT Permalink Options

How do I modify the Settings > Permalinks (options-permalink.php) admin page to add more custom permalink parameters? I'd like to add additional permalink parameters to the "Optional" section for ...
0
votes
1answer
1k views

custom wp_editor does not save the content in plugin settings

I am creating a custom settings page for my plugin. I have four textarea fields, Which need to be replaced by wp_editor. My problem is that I am not able to store the data to database. Bellow is my ...
0
votes
1answer
563 views

WP Page Options Array

I'm creating a page options which contain some multiple checkboxes with specific values. Here is a snippet of my checkboxes form code: <label>Global Checkboxes</label> <input ...
1
vote
1answer
2k views

How to add settings subpage from a plugin to a settings page created in theme?

I'm using add_menu_page(...) from a custom theme and I want to add subpages to that menu with add_submenu_page(...) . If I try to do it from the theme it works as expected but when I try the same from ...
3
votes
1answer
144 views

do_settings_sections() doesn't escape quotes

I'm using the Settings API on a custom settings page: <form action='options.php' method='post'> <?php settings_fields('myplugin_settingsPage'); do_settings_sections('...
2
votes
1answer
1k views

What exactly is the purpose of settings_fields()?

In the API description for settings_fields() it reads: Output nonce, action, and option_page fields for a settings page. And a look in the includes/plugin.php file turns this up: function ...
2
votes
1answer
599 views

Theme Customizer - How to create a sub panel

In Theme Customizer, i'd like to create a sub panel like this one of wordpress: When we add a new item, a new panel which allows us to pick up a item displays on the right, how can i do the same ? ...
0
votes
1answer
1k views

how to get wp_editor to save data in plugin admin page

I'm trying to use plugin settings api to add wp_editor, but the text is not saving. // add the admin settings and such add_action('admin_init', 'my_plugin_admin_init'); function my_plugin_admin_init()...
0
votes
2answers
1k views

Customizer_register not saving custom setting to database

I'm currently trying to work on a WordPress theme based on Sage. The stage I'm at is creating custom controls to display on the customize screen for WordPress where you typically change things like ...
0
votes
1answer
126 views

Multiple page plugin settings

I am building a plugin and I have made a single setting page that is working without any issue. Since it is becoming very long, and that it is made of 3 distinct sections, I wanted to split it in 3 ...
2
votes
3answers
5k 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'...
4
votes
1answer
2k views

Flush_rewrite_rules not working when settings updated

I have added some custom options to my WordPress CMS within the Reading admin page. I am using these options to set some additional pages that I then have bound to custom operations. This method ...
0
votes
1answer
60 views

WordPress Setting API - There is no field in options.php

I am creating a small WordPress plugin. I created setting page and there are two user inputs in setting page. I created two option types. Those are rmpm_post_newcount and rmpm_post_newname. After ...
1
vote
1answer
134 views

Settings API - Separating PHP and HTML

I've created a plugin where the settings are configured on different tabs. Each tab saves its settings to a different field in wp_options. The HTML for each tab is separated out into its own file so ...
0
votes
1answer
87 views

Getting all the settings for a plugin

Looking at the Settings API and you can register new setting using register_setting() but I can't find a way of getting all the settings for a certain plugin. Let's say I want to get a list with all ...
1
vote
1answer
3k views

How to fix Uninitialized string offset: error on a checkbox in WP Settings API

I am trying to create an options page with a checkbox field. The checkbox is working fine but when I uncheck it and save settings, an error string shows on Notice: Uninitialized string offset: 0 in ...
1
vote
1answer
490 views

Splitting do_settings_sections within HTML?

This seems like it should be very simple to achieve, but I have spent far too long trying to figure it out. I have two settings sections: add_settings_section( 'cp_required_info', 'One', array($this, ...
0
votes
1answer
280 views

Warning: call_user_func() expects parameter 1 to be a valid callback

This my code: $array_theme_options = array( array( 'id' => 'facebook_url', 'title' => 'Facebook Profile Url', 'callback' => 'display_facebook_element', '...
1
vote
1answer
228 views

Storing HTML in wp_options

I'm giving my users the option to store HTML in an option with a wp_editor(), using the wp settings api to handle the form. I currently do not apply any data sanatization to it, but realize I probably ...
0
votes
2answers
3k views

Allow HTML in Settings API input field

I want to allow HTML into a plugin input field via a user, I am using the Settings API, but it strips everything HTML out. - Code below -any pointers? function plugin_settings(){ register_Setting( ...
0
votes
1answer
35 views

Can someone tell me where I've gone wrong with this plugin's Settings page?

I've been trying to learn how to make a plugin in my spare time. I'd previously done all of the coding pertaining to the settings page and it all appeared to work well. Having completed some other ...
1
vote
0answers
96 views

Save & Publish disabled for two dimensional array Customizer

I am developing custom control in customizer. Control Its 4-5 textboxes that I can sort internally. Its a foreach loop. textbox1 textbox2 textbox3 .. The data stored is in array. $theme['textbox'][...
3
votes
0answers
266 views

Cannot update my options using wp_ajax

I have implemented wp_ajax in on my options page but the value of my options are not getting saved or updated. Here is my form: public function email_settings_form(){ // Set class property $...
1
vote
1answer
233 views

Am I using the flush_rewrite_rules function in the right place?

Hello dears I'm writing an admin panel for my new WordPress plugin base on the WordPress Settings APIs. I am defining a field for changing custom post slug from this admin panel. After the custom ...

1 2 3
4
5
9