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 [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.

0
votes
0answers
21 views

Cannot save with wp_dropdown_pages() in page options

I don't understand why, the custom select option works, but even when wp_dropdown_pages() is outputting the same exact HTML, it doesn't save as the select option does! I'm out of ideas :( Here's my ...
0
votes
0answers
7 views

Hide / show settings field based on other field's value

I created a class to manage my plugin's settings, this works okay apart from one thing - I would like to hide fields lal_login_text, lal_logout_text and lal_account_text together with their labels ...
0
votes
1answer
8 views

Settings page - can't change checkbox to unchecked

I thought that I got my plugin settings finally working with defaults, without overriding db with them, but it's only the case for acau_update_delay which is numeric value and not for the checkboxes. ...
0
votes
1answer
39 views

Default settings aren't used

I use Example #2 from this source: https://codex.wordpress.org/Creating_Options_Pages Using a class, it creates settings page. I can access values like this: $options['id_number'] Or remove ...
0
votes
1answer
28 views

How do I render content from a wp_editor in a plugin setting field?

I have a plugin setting that uses wp_editor() to handle the input and will get echoed as part of a shortcode. Everything is working great on the admin side but when I echo the output on the client ...
2
votes
1answer
35 views

plugin development: storing language specific options

I'm currently rewriting a little plugin that shows visitors a small info text. This plugin is German only so far and so I want to add multi language support as I am working on a page that should be in ...
0
votes
1answer
23 views

Settings Fields not showing up in Submenu Page

I'm working on my first plugin. I am having difficulty getting the settings_fields function to display the results of the settings fields' callback functions. I've been studying the settings api, but ...
0
votes
1answer
48 views

Some fields in Settings API form are saving, others are not

I have a class used for a plugin's admin form, using the Settings API. It has a lot of fields, and some of those fields depend on already existing values in wp_options. The existing options determine ...
0
votes
1answer
30 views

Whitelisting items from custom options page

I'm a relative beginner, so anything that points me in the right direction is appreciated. I'm trying to whitelist options from the admin panel. I have an array in another file (item-whitelist.php) ...
0
votes
0answers
21 views

woocommerce plugin to query external vendors REST API

All, I am attempting to assist a friend with some research as to how much it efford /cost it would take to start a woocommerce site to sell ATV/Motorcycle parts and accessories. The site would be ...
0
votes
1answer
28 views

Display shortcode in text field with wordpress settings api

I'm trying to figure out how to display the output of a shortcode in a text field using wordpress settings api. My goal is to create a few shortcodes so that I can use one or the other along with some ...
0
votes
1answer
77 views

update_option_$option action not working as expected

I have a custom admin page that uses the settings API. Form submits to options.php. After submission I am attempting to do something in the background. I am hooking into update_option_$option to do ...
0
votes
0answers
18 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
26 views

Error: options page not found when I try to save the changes made in my settings page

I'm developing a plugin... everything was fine but suddenly when I try to save the plugin settings.. I found with the error that says the page options not found.. I was looking for some answer but ...
0
votes
1answer
42 views

Saving multiple checkboxes with WordPress settings api

I'm having trouble saving multiple checkboxes using WordPress settings api. I can add multiple values, but only the last checked box gets saved. This is what I currently have function ...
0
votes
0answers
16 views

Options API: Options does not save

My Settings wont save and I dont really know why. Here is my Code: <?php class STLI_New_Settings { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $...
0
votes
1answer
24 views

Integrating colorpicker into array field

I am using this code and i am trying to show a colorpicker onto an array field. Any ideas, how to do it? <?php class Smashing_Fields_Plugin { public function __construct() { // Hook ...
0
votes
0answers
19 views

How to store colorpicker hex color using options API?

I wrote the following code, which works fine in displaying a hex value if its not set, or if its set already. I want to save the selection of the colorpicker, using the save button, but something is ...
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'), ...
0
votes
1answer
27 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
1answer
10 views

input on custom settings page adds http://

how do I get the textbox to not add the HTTP://? function skype_callback() { $options = get_option( 'theme_social_options' ); $url = ''; if ( isset( $options['skype'] ) ) { $url ...
1
vote
0answers
62 views

The plugin does not save data

I'm trying to make the plugin save data, but I'm getting this error and I do not know why. The code: function ippluginmenu() { add_menu_page( 'ip configuración', 'ip', '...
0
votes
1answer
23 views

How to save the option's new values plus old value without overwrite old one

i have just tried this function myplugin_update_field_foo( $new_value, $old_value ) { if ($newvalue !== $oldvalue && !empty($oldvalue)) { $newvalue = array_unique( array_merge( $newvalue, ...
0
votes
1answer
32 views

Reading settings in the home page precisely home.php

/* ---------------------------------------------- */ /* Setting Post Limits on the HomePage */ /* ---------------------------------------------- */ if ( ! function_exists( 'the_post_limit' ) ) { ...
0
votes
0answers
184 views

options.php not found when saving Theme Settings

I am building a custom theme from the Underscores starter theme (https://underscores.me/), and am building a theme settings page. When I go to save my fields, I get the "Error: options.php not found" ...
1
vote
1answer
45 views

Settings not set after calling register_setting()

I have a plugin with an activation hooked function. This function has to register 4 setting variables. I can't see why, but only the first setting is registered correctly, the last 3 are somehow ...
2
votes
1answer
69 views

Stop the form of beign submitted on “Save changes” custom option page

Using the Settings API of Wordpress i want to try cancel the submission of the options when the validation/sanitization fails. Registering the settings: register_setting( 'mysettingspage', '...
1
vote
1answer
43 views

Disable <th> $title in Plugin Options Screen?

Is there a way, using the Settings API, to disable the use of the cell of the table created for options? The add_settings_field 2nd parameter is the $title attribute (string) and is required. This ...
0
votes
0answers
14 views

Best way to set additional option when settings page form is submitted?

I have an input on a settings page that is stored as option_a. When the form is submitted I also want to set option_b which is calculated usingoption_a. I can think of two ways to do this. The first ...
0
votes
0answers
38 views

Options saved and called in wrong order

for a plugin i am creating i want to execute a function only when the specific options is updated to save ressources. It works so far, but the hook update_option_{$option} should normaly be fired ...
0
votes
1answer
134 views

Saving array of data to database using wordpress settings API

There.Hope all of you have a wonderful weekend. I am currently developing a wp plugins and having problems of how to save array of data using its settings API.I know i can do this <select name = ...
0
votes
0answers
39 views

Why Settings API Options Override Customizer Settings?

I Developed My Theme To Provide two Ways of Customization, Settings API & Customization Manager API, After Finishing the Work in the Dashboard , i tried to implement them for the front-end ...
0
votes
1answer
96 views

check for the current screen

i'm working on my core theme plugin, i created a theme options in theme admin page, normally to avoid nonces errors, i must separate the sections with tabbed navigation, so i successfully did it , the ...
0
votes
0answers
59 views

Display Each Setting Section In Each Specific Tab within Same Page || Settings API

as everyone knows, when we want to display some setting section in some specific page, normally we must pass to it the slug-name of the page where we want to dispay it . it work 100% , but the problem ...
1
vote
1answer
126 views

WordPress Settings API - Sanitize Integer

I am sanitizing a text field input via a custom WordPress Setting API page like this... public function current_issue_sanitize($input) { $sanitary_values = array(); if ( isset( $input['...
7
votes
1answer
315 views

Accessing plugin settings in gutenberg

I'm trying to build a gutenberg block (via plugin) that interfaces with a third-party api via credentials. I'm unsure how to, or even if I can, access a plugin's settings in gutenberg in order to grab ...
4
votes
1answer
655 views

add static page to reading settings for custom post type

I created a custom post types and I want to let the user choose the static page for the archive page. For example, under Post page. I would like to add a Projects page: [ Dropdown ] Is there a way ...
0
votes
1answer
20 views

not getting API setting saved confirmation message after update on option page

I am able to add option page to dashboard Menu and so far it works properly (at least to me) But I am not getting API Setting Saved Message after updating the page add_action( 'admin_menu', '...
0
votes
1answer
51 views

Wordpress Boilerplate Plugin doesn't see callback functions for add_settings_field and add_settings_section

I am developing my first plugin, and I have an options page setup. Now, I am trying to add some fields. I have this in xxx-admin.php in admin folder public function section_callback() { echo ...
0
votes
0answers
32 views

How to display status messages in admin panel

I recently followed the steps here https://codex.wordpress.org/Settings_API in order a create a setting page for my theme. The code works, the data gets saved in the database without any status ...
0
votes
0answers
44 views

How do I add a textarea (multirow) option to my Wordpress plugin?

I'm getting a little confused between the options and settings APIs. I want to add three multirow text fields (displayed as a textarea) for my plugin. I just want to allow the user to specify three ...
0
votes
1answer
35 views

How Can I Update wp_enqueue_scripts () From WordPress Option Page Radio Buttons

Can you please take a look at this script and let me know how can I update the wp_enqueue_scripts () in theme functions.php based on radio select in custom option page? what I have in function.php is ...
4
votes
4answers
2k views

How to display an admin notice after updating plugin settings?

I have a plugin with a setting page, and there are some action that have to be done when a certain option is saved. I am using the pre_update_option_ hook to do this. So far so good. If something goes ...
1
vote
1answer
462 views

Custom delete option button in plugin settings

I would like to add Delete button next to my file Upload option in my plugin settings. At this moment I am using Settings API, using form below. <form method="post" action="options.php" enctype="...
1
vote
0answers
17 views

Manipulate javascript code from custom made admin page menu

I have javascript peace of code that I load into my custom template page. It is quiz application based on pure javascript and I keep the questions with answers inside the array object. The thing is ...
0
votes
1answer
69 views

redirect on theme switch - WordPress

How to redirect on theme switch to my theme option page, what is the best to redirect wp_redirect or wp_safe_redirect: here my code: <?php function sunset_add_admin_page() { //Generate Sunset ...
0
votes
1answer
748 views

How to make Color Picker update element color from custom theme options

I created the plugin below to add custom theme settings to my theme but I am not sure how to update the element colors by using the color-picker. I would like to be able to change the background color ...
1
vote
1answer
65 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 ...
0
votes
1answer
130 views

settings api - add_settings_section not working

I'm building a plugin options page but I can't get the sections to appear. This is my code: ini.php: class Setup { public function init() { add_action( 'admin_menu', array( $this, '...
1
vote
1answer
122 views

When to use add_settings_section vs just register_setting?

I’m trying to add some options to my plugin but can’t understand why use add_settings_section when you could just use register_setting? I’m registering my settings page via add_menu_page like so: ...