Stack Exchange Network

Stack Exchange network consists of 174 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
19 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
17 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 ...
0
votes
0answers
9 views

How can I add and where can I put travel APi in my WordPress website

How can I add and where can I put travel APi in my WordPress website. Means, my website is totally based on post ads and I want to add travel API so that anyone can access it through my website and ...
1
vote
1answer
33 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
24 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
50 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
29 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
84 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
28 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
59 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
27 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
115 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
36 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
64 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
40 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 ...
0
votes
0answers
10 views

Is it possible to use Settings API on a page generated by add_menu_page()

I want a fairly simple options page in my WP backend. It is just the one page, so only need to run add_menu_page(). In other words, I don't want to call add_submenu_page(). I know I can build the ...
1
vote
1answer
75 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
163 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 ...
3
votes
1answer
426 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
18 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
0answers
29 views

Adding Multi None Grouped Check boxes Into Section of Option Page

Using WordPress Settings API and following code I need to Add several Check-boxes (Not Grouped Checkbox) to an Option page. As you can see the add_settings_field(() is adding only one input checkbox ...
0
votes
1answer
34 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
27 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
36 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 ...
0
votes
1answer
350 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
60 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
676 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
52 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
91 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
101 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
662 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
95 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
41 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
57 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
0answers
26 views

When storing small amount of data should I use Option, Settings API or custom table?

I am relatively new to WordPress and saw some of related questions but they where mostly old. Not sure what is the optimal way to store data in the current WordPress version. I need to store a list ...
0
votes
0answers
428 views

Why WP customizer postMessage transport is not working?

I am MS Shohan and am new to WordPress development. I tried to set postMessage transport of blogname and blogdescription settings but I don't know why it is not working. Can you please find out the ...
0
votes
1answer
22 views

Settings API and 'type' => 'font'

array( 'name' => 'textarea', 'label' => __( 'Textarea Input', 'wedevs' ), 'desc' => __( 'Textarea description', 'wedevs' ), 'placeholder' => __( '...
0
votes
1answer
37 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 ...
0
votes
2answers
66 views

Update WP option by plugin

I wanted to set value of WP option (more specifically - 'admin_email') by using plugin, its option (plugin option) and update_option(). I tried using lines like below, but when plugin code contains ...
0
votes
2answers
451 views

add_settings_error on validating plugin options API

I am developing a plugin which uses options API. I defined a class that uses a function to sanitize the inputs, but when I submit the options form, It displays errors and info twice. And also I didn'...
1
vote
1answer
449 views

Plugin settings page checkbox not saving - one options array with sub array

I'm driving myself crazy here trying to get a checkbox to save on a plugin settings page. Right now, as a template, I'm working through the excellent example given here: Settings API with arrays ...