Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [options]

In WP `options` is the term used for variables stored in the database. They are accessed through the options API.

Filter by
Sorted by
Tagged with
1
vote
1answer
26 views

settings_fields doesn't appear to be running

I'm creating a settings page for a plugin. It adds: a submenu item registers a setting adds a section adds a field and then renders the page/section/field. It is all pretty straightforward, only "...
0
votes
0answers
11 views

How to create a Settings Page with a list of existing taxonomies and allows the admin to associate a CPT with these?

I'm working on a plugin that includes a custom post type, by default this CPT will not be associated with any taxonomies. On the Settings page for the plugin I'm looking to show a list of the ...
0
votes
0answers
18 views

How can I change WPML settings programmatically?

I'm trying to change WPML settings programmatically, as suggested in these posts: Disable auto sign-in programmatically Overriding the WPML settings My goal is to disable a WPML's feature that ...
0
votes
1answer
12 views

save short-code in my custom plugin settings problem missed something

i want to have dynamic shortcode to CF7 when i create new Contact form the id is different from develop env to production i decide to put my shortcodes in my plugin settings. and use them as ...
2
votes
2answers
39 views

Best practice differences in DB options and wp-config between live, staging and local WordPress environments?

I've been using staging sites for years. So I'm not asking about the necessary difference to setup a working staging site such as search replacing URLs, dev version control branches, changing table ...
0
votes
0answers
12 views

How to get settings of widget before rendering?

I would like to do something in a widget before any HTML renderering takes place, and I need it's settings. Using the widget() method is already too late. I tried something like this, from constructor:...
0
votes
0answers
44 views

Sanitizing array in wordpress options page

I have an array like this [select_post_template_repeater] => Array ( [0] => Array ( [0] => post [template] => ...
2
votes
1answer
76 views

Logout redirects to a broken page(home URL is omitted)

I'm using the latest version of WP. I have a problem, where clicking the logout button from the admin panel redirects to a completely broken link: http://wp-login.php/?loggedout=true As you can ...
1
vote
0answers
19 views

Show admin notice on incorrect value on form field

So I'm still learning about the Settings API on WordPress and can't seem to figure out how to handle admin notices on an empty database and then have validation. Registration: function ...
0
votes
0answers
8 views

Is there a way to add an unlimited amount of image controllers?

Is there a way to add an unlimited amount of image controllers in the customize section ? For example, If you have one image controller setting with cropper, but you want to add several more ...
1
vote
0answers
21 views

How to set wp_editor to be email friendly?

I am sending emails via wp_mail() using a text/html header. So i need html formatted content. I want to use wp_editor() to edit my custom email template options. It has a Visual and Text tab for ...
1
vote
1answer
20 views

How do I update a nested option?

I use this command to get values of ez-toc-settings->auto_insert_post_types wp eval "print_r(get_option('ez-toc-settings')['auto_insert_post_types']);" and this prints out the correct values: ...
0
votes
0answers
9 views

Updates on 'wp_options' cause MySQL binlogs to get huge

Our WordPress sites (20-30 sites) are generating a significant number of UPDATE requests to their respective wp_options tables. They add up very quickly to the size of MySQL's binlogs, and these ...
0
votes
0answers
18 views

options getting deleted on save

I have a callback function for a field like as below. It's a repeatable field it works but on every save a field is gets removed. Say if there are 4 repeated fields on save it reduces to 3 and on next ...
0
votes
1answer
60 views

how to compare update_option() after it saves to database?

i am having trouble getting any usable information or example of the update_option action hook. my aim is to compare both old and new value of my data, then send email to user for changes. below is ...
1
vote
0answers
15 views

How to display options page under custom menu?

SOLVED: I managed it to solve by using add_sub_menu I have this code to create an options page. But this shows under the setting( code is from WordPress documentation. I want to display it under my ...
0
votes
0answers
62 views

How To Change Caption Background Color in Fusion Slider using Avada Theme in WordPress?

I am working on WordPress for 2 years and have familiarity with executing quite complicated and tricky operations using CSS but something is currently wrong with my system / the website or my theme ...
1
vote
1answer
30 views

How to add a default value to get_option if it's used as a variable?

How to add a default value to get_option if it's used as a variable ? The code : $my_options = get_option( 'my_options' ); // Associative Array 'my_options'. <div id="identifier" class="...
0
votes
0answers
11 views

Save multi-inputs as nested-array with options.php?

I'm building an admin-page under tools.php and am looping our data and some text fields, I would like to know if it's possible to save text fields with the same name as nested-array saved to options....
0
votes
0answers
29 views

Change SKU label to Barcode in woocommerce

We need to change SKU Label to "Barcode" Because of a 3rd party software. Is there any possible way of doing this? Maybe hooks or stuff? Was thinking of using Jquery but that might be really dirty.
0
votes
1answer
19 views

Exclude categories with only sticky posts OR count sticky post of specific category

I want to create a page which displays all categories with posts. My goal is to exclude categories which only has sticky post(s). That's the part which isn't working so far. My current results looks ...
0
votes
0answers
7 views

How add a post type grid page to a plugin settings page?

I'm writing a plugin; this plugin create some settings pages in backend and one custom post type. Can I show the standard Wordpress posts grid (like "Posts", "Media", "Pages" and CPT) in a settings ...
0
votes
2answers
20 views

get_theme_mod only returns false

I have created a custom section with a setting with one control allowing users to choose fonts from a dropdown. However, when I use the get_theme_mod() function, and echo the results to a styles tag ...
1
vote
2answers
46 views

array_map() for sanitizing $_POST

I am working on an options panel for a plugin. And have an array being posted and updated to the options table. I am using the array_map() function to iterate over the array with sanitize_text_fields()...
0
votes
2answers
50 views

i do not see the “site url and home options” under Wp_Options (phpmyadmin)

I wanted to show you this issue. This is happening first time with me in my 10 years career, I have cloned many sites to another domain in past but this is for the first time when I do not see the "...
0
votes
2answers
63 views

It is possible to add custom media size in admin media edit?

Hi! It is possible without plugin to add ability edit custom thumbnail image size and apply changes to it?
0
votes
1answer
16 views

Admin page changes the $_POST data

I'm trying to save a json array to the database, and i created the following class defined('ABSPATH') || exit; class Theme_FAQ { public function __construct() { add_action('...
2
votes
1answer
23 views

Can't access 'Store uploads in this folder'

I have had a problem uploading images from my laptop onto wordpress. Basically, the images are broken and cannot be viewed when implemented on the site. After trying to rectify the problem through ...
0
votes
1answer
49 views

Same ACF Relationship field for multiple Post Options sub-pages?

How can I ensure that the data saved by an Advanced Custom Fields Relationship field, when on an Options page for a Post type, is separate? Detail below: I have an ACF field group, “Features”, ...
0
votes
1answer
50 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
0answers
17 views

Convert siteorigin page builder data to themify builder data

I am attempting to convert the widget data saved in the database by siteorigin over to how themify builder does so, possibly make how each option is saved more efficient such as making a specific ...
0
votes
0answers
17 views

Disable prepublish/fullscreen mode with filter

I would like to remove the option to enable the fullscreen mode and pre-publish check in Gutenberg. For my current project, there is no need for these features as I modified the editor quite a bit in ...
0
votes
1answer
43 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
vote
0answers
24 views

Options page - dropdown of users

I want to create an options page in WPAdmin that will let me select among registered post type "Members" and anoint them as "captains". Here is my code so far but the dropdown is not functioning ...
0
votes
2answers
35 views

How to set different color in a select box due to selection with css

I have a select box with 2 options. In the selct area the options are green for 1 red for 2 I had been able to set green also as the color for the predefined option. Now I would like to change this ...
0
votes
1answer
303 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
23 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
14 views

Plugins Settings page not updating

After following this tutorial in mostly everything, except the naming, I am currently facing an error: Error: Settings page wasn't found (translated) This is my code: class ConfigPlugin { public ...
0
votes
0answers
222 views

wp_options Table keeps growing

wp_options Table keeps growing. I few days ago this issue started on my blog. I though it was a plugin problem but couldn't find a way a out so I delete it everything, wp, database, all. New ...
0
votes
1answer
79 views

Block properties, attributes and settings

Reading the Gutenberg Handbook about the new Block architecture in WordPress, I've come across references to "properties", "attributes" and "settings" for the blocks. As there's a lot to read, I've ...
0
votes
0answers
24 views

How can I stop an custom field value from appearing in a dropdown list

I have a dropdown field that displays custom values that I can add from the admin portal. I would like to exclude an option called 'Meal' so it does not show in the dropdown field on the frontend The ...
0
votes
1answer
315 views

OceanWP settings are missing from Add New Post [closed]

When logged in as Author, the screen options do not include OceanWP settings. If logged in as Administrator, the options do include OceanWP settings. The Author needs these settings to remove such ...
0
votes
0answers
20 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
0answers
62 views

centralized alternative for get_option: get_site_option, get_network_option or get_site_meta?

When storing option for current-site (sub-site), we use get_option, however, when we want to have one centralized option (which should apply to all sub-sites, including the primary sub-site), which ...
1
vote
1answer
42 views

Define a wordpress constant through plugin functions?

I'm working on a plugin and trying to build in an option to disable post revisions. I have the setting registered, and confirmed that the checkbox is linking to the database. The option value is ...
0
votes
1answer
41 views

redirect to https://my-site/wp-admin/ instead of https://my-site/wordpress/wp-admin/ after options updating

I installed my plugin for one of my clients but I got a bug. In my plugin settings page using the wordpress settings system, when I click on the submit button to activate a license key, the ...
0
votes
0answers
196 views

WP_SITEURL vs WP_HOME link output

When WP_SITEURL and WP_HOME are set to different values - for example https://example.com/wordpress and https://example.com - the output links are inconsistent. Thus, a permalink output will be ...
0
votes
1answer
15 views

Hide admin menu on update_option

I want to show custom sub menu page, if get_option is true else just hide sub page. My function must do, if input value posted as 1, show sub page else hide sub page. But problem is, when i post 1 ...
0
votes
1answer
35 views

update_option returns false in AJAX, how to debug?

I tried debug plugins for WordPress, but they only show the current page SQL queries. How to debug if update_option returns false? I am updating an object decoded from AJAX request with json_decode ...
0
votes
0answers
7 views

Store “cacheable” data recieved via Ajax to wordpress database?

I am requesting data from an outside API for display via shortcode. All that works. I'm even caching the response in the [options] table to speed up subsequent page loads. However, the initial page ...