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
1answer
25 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) ...
-1
votes
0answers
16 views

Trying to tie a input range and input number field together [closed]

I'm trying to tie an input range and input number field together but not having much luck. I tried the answers here and modified it to suit https://stackoverflow.com/questions/34360448/is-it-possible-...
0
votes
1answer
25 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
22 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
16 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
18 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
30 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
14 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
23 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
18 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
25 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
56 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
132 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
32 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
66 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
33 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
13 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
127 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
38 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
78 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
48 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
98 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
237 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
509 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
19 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
41 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
29 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
40 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
1k 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
404 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
66 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
720 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 ...
0
votes
0answers
62 views

Plugin : execute function once “options page” has been saved

I'm building my first plugin with Wordpress. Its purpose is to hide some menu entries in the admin panel. I have created an "options page", which appears under "Settings", and I have managed to ...
1
vote
1answer
64 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
113 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
112 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: ...
1
vote
1answer
743 views

PHP Notice: Undefined offset: 0 in /wordpress/wp-includes/plugin.php and Register Settings API change

Errors of the following type encountered with a plugin running on WordPress v4.6.x and isolated to a register_setting() call. [02-Nov-2017 00:55:35 UTC] PHP Notice: Undefined offset: 0 in /wordpress/...
1
vote
1answer
108 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 ...
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
2answers
60 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 ...
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 ...
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
38 views

settings api sub menu and data not populating

IN FUNCTIONS.PHP → locate_template( 'inc/admin/class.settings-api.php', true ); locate_template( 'inc/admin/o-functions.php', true ); o-functions.php code: <?php /** * Registers settings ...