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
0
votes
0answers
10 views

Add Plugin options as subpage to Theme options page

I have my own Theme with an options page. Now I am developing a new Plugin which should have an options page that should be a subpage of the Theme options page. Theme options.php: <?php function ...
1
vote
0answers
26 views

changes to widget settings not showing up in individual pages pages until they're updated [closed]

I'm using a plugin to add a widget to my sidebar. That widget has some settings that I'm still fiddling with in order to get things right... After adjusting the settings on the screen above and ...
1
vote
1answer
21 views

Saving repeated option values when querying in Published, draft and all

I have a custom query that has some repeat option values. I have three tabs that query Published, Draft and All. When under the Published tab and saving a value, it removes all the values under Drafts ...
0
votes
1answer
20 views

Is saving data to WordPress options as array bad thing to do?

With a form I am saving the data to WordPress options, it's a big multidimensional array. The problem that I am facing is sometimes it misses a value in the array. I am not sure how to debug that as ...
0
votes
0answers
11 views

Custom setting to show or hide field

I've got a custom post type (Places), and that post type has a custom field to indicate that the Place is a participant in a holiday-season promotion. I would like to create a setting somewhere so ...
0
votes
1answer
42 views

How to check False booleans when using get_option?

Whenenver you do get_option( 'my_option' ) and that my_option is literally False itself, you cannot simply check for if( !get_option( 'my_option' ) ), to see if the value exists, because it'll return ...
0
votes
0answers
14 views

How do I give the user the option to toggle the sidebar to the left or right side of the theme?

I know how to create a settings page with add_menu_page, and add a drop-down menu with two options using add_settings_field. What I need to find out is how do I then allow the user to save their ...
0
votes
1answer
24 views

Woocommerce product options [closed]

I have custom realization - where i can add to product items, i can get for product items like this: <?php if(!empty($cart_item['more_product'])) : $first_array ...
1
vote
1answer
32 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
14 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
22 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
14 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
47 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
48 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
85 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
21 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
27 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
25 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
14 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
71 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
18 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
139 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
34 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
21 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
41 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
25 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
9 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
45 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 ...
2
votes
2answers
114 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
277 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
71 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
18 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
47 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
127 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
51 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
18 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
18 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
56 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
51 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
428 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
27 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
332 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
102 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
468 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 ...