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
2answers
69 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
488 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
31 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
15 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
373 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
128 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
1answer
551 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
79 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
63 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
52 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
248 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
18 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
39 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 ...
1
vote
1answer
167 views

How to save widget fields generated from an array?

I created simple php abstract widget class that can generate form with fields from an array. When I try to save fields, all changes are removed. Abstract Widget Class: <?php /** * Abstract ...
1
vote
1answer
215 views

get_option() not returning expected value from plugin

I am trying to make my first plugin, and so far everything has been fine except one little annoying thing. I have my fields setup and updating data and looks just fine in my database: mfwp_settings |...
0
votes
1answer
41 views

Unable to delete option

I am able to delete the option with form action admin-post.php but it gives me a blank page after clicking the button <form action="<?php echo admin_url('admin-post.php'); ?>" method="post"&...
0
votes
0answers
28 views

Delete WP option with a click of button [duplicate]

I want to delete an option from the wp-options table when clicked on a button in the back-end. i have created an option with this : get_option( string $option, mixed $default ); is there any ...
0
votes
1answer
83 views

Is there a limit to size of data stored in update_option()?

I've checked out several* questions and WP docs and I have some idea of the answer but am looking for a specific number on the following questions: 1- Is there a limit to the size of data (kb,mb, ect)...
0
votes
1answer
170 views

checkbox with get_option not working

I am trying to figure how to have check box implemented in options page . i am able to get the default values but not save and retrieve it . i am using get_option() and checked() functions <form ...
0
votes
1answer
117 views

get_option() does unserialize and don't remove \

When i update_option() with special caracter, for exemple BARCA D'AREGOS the serialize option puts save like that BARCA D\'AREGOS on database. If i do get_option() the display value is BARCA D\'AREGOS....
0
votes
1answer
13 views

Is there an optimized, WordPress-y way to not call a `get_option` twice?

I'm currently trying to get an option and if it's not present, simply assign an empty array as this variable: $option = get_option( 'option_name' ) ? get_option( 'option_name' ) : []; The problem is ...
-1
votes
2answers
89 views

Using get_option() for check box field

I am trying to have a check field saved to database. it works . but in get_option i am passing the default value. but even if disable the checkbox(value 0) the field shows as ticked ..this is my code ...
0
votes
1answer
555 views

Wordpress options page not saving

I've create an option page in Wordpress. After some hours of work I was happy that I can see my expected content on my settings page. But when I press the save button I'm getting redirected to the ...
2
votes
1answer
316 views

How to create a Page alias in WordPress

In the image you see... WordPress has alias for Pages like Home Page, Checkout Page, Privacy Policy Page and any appear beside the page you assign them. How to create this feature in WordPress? If I ...
1
vote
1answer
38 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
0answers
66 views

Some entries delete_option doesn't work

I use delete_option to delete all my database options when my plugin is uninstall or when users click a button: Remove all settings and cache <form action="<?php echo admin_url('admin-post.php')...
0
votes
1answer
144 views

Button to clear transients

I would like to add a button on the admin page to clear the transients I use. See my code below: <?php // If this file is called directly, abort. defined('ABSPATH') or exit(); /* * Generate the ...
0
votes
1answer
31 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 ...
1
vote
0answers
20 views

How to remove traces from widget during uninstallation

I have a small plugin, which registers a custom widget and now I am wondering how to remove all traces of this widget when the plugin is removed through the administration. If I look in the database ...
0
votes
1answer
153 views

How to use update_option() without replacing/losing the old value?

I want to update an option, but instead of replacing the old value with the new one, Ì want to add new value to existing one. So the new value should be $oldvalue + $newvalue. I read about ...
0
votes
1answer
25 views

Plugin Options Page and Subpage

I'm working on a plugin which it's options need to be managed by admins and super admins [yes, it's a network site]. the idea is that super users can create resources which are then enabled by the ...
2
votes
1answer
80 views

update_option_{$option} Too Few Arguments

Adding a callback to "update_option_{$my_option}" results in the error Too few arguments to function. My callback accepts $old_value and $new_value. If I remove $new_value from the callback ...
0
votes
1answer
322 views

Problem with Settings API: changes are not saved after submit

I'm writing a plugin "Paid Post" with some options. I made a settings page for my plugin, and it displays OK, but when I'm pressing "save changes" button, the option I have do not change, it just ...
0
votes
1answer
78 views

How to implement theme option to change bootstrap 4 container from .container to .container-fluid

Developing wordpress theme from scratch, I got some basics, but, as I start to make templates for changing the look of a page (like 1 or 2 or 3 columns, with or without sidebar...), an idea came to me ...
0
votes
2answers
235 views

Optimized PHP & Wordpress settings for speed/performance?

I have a big site with several plugins that take up memory, a lot of requests to the server, etc. I've maxxed out my hosting to help account for this, but are there optimum PHP and Wordpress settings ...
0
votes
1answer
233 views

save multi-select input using update_option for plugin

Trying to save some plugin data to the wpdb using the update_option method. This code works fine for my single value ad_url, but fails for my array exclude_posts. The POST data in Chrome dev panel ...
1
vote
0answers
44 views

How to change user admin_color with WP CLI?

I like to know how I can change a users admin color theme with WP CLI.
0
votes
1answer
44 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
666 views

How to Fix WordPress Not Saving Settings?

How Can I Manually Fix & What is The Root Cause? The Site Language setting in Settings > General for my site, will not update. It is stuck on English (United States). I have done all the ...
4
votes
1answer
327 views

Multisite: How to store global options vs. site options?

Hey there I am pretty confused on how to store network wide options within a WordPress multisite installation. The usual way to store any settings in WordPress is: add_option(); update_option(); ...
1
vote
1answer
184 views

Add option for editors through `register_setting`

I want to add some options in wordpress admin panel which editors also can update through a form. I have used register_setting() function to add those options. For administrator this works fine, but ...
1
vote
0answers
16 views

ERR_TOO_MANY_REDIRECTS when i config my subdomains

I use multisite like this 144.1.1.3 and 144.1.1.3/another_site I need to use two subdomains like this mysubdomain.mysite.com.br for 144.1.1.3 and mysubdomain2.mysite.com.br for 144.1.1.3/...
1
vote
1answer
42 views

using wp_sprintf at wordpress option page,

I'm using a custom option page to control default setting of my plugin, in one part I need to let the admin add a text which will be send through sms, I need using some predefined text (such as ...
1
vote
1answer
31 views

Add New Sub Site from the WordPress back end then in sub site options table option_value must be with https

I installed multi site setup for the domain https://uninfo.org but when i add new sub site from the back end it is creating but in sub site WP-options table it created with HTTP rather then https ...
2
votes
1answer
363 views

Implement a multi-value input field where the number of entries is not limited

I am developing an application (plugin) where the user needs to enter any number of number of phrases in the settings page and these will be used by the plugin. I have implemented this to capture the ...
0
votes
0answers
28 views

How to create plugin settings page for each admin user?

I have to develop a plugin where it is required that each admin user should have different settings for the plugin. Forexample, email settings should be different for each user, lets say user A filled ...
2
votes
1answer
355 views

possible to make sections in theme customizer sortable and saveable at publish button clicked?

We do have kirki(a theme customizer toolkit) sortable field. But i want to apply the same logic on the sections itself instead of creating another section with sortable fields. I'm using options ...
0
votes
1answer
31 views

How to update option field in database on clicking the publish button in customizer

I want to use update_option('option_name', $new_array) to change the database option value when user clicks the publish button in wordpress theme customizer. How to do it?
0
votes
1answer
25 views

How to add the option to choose between sizes for featured image within post editor?

Drew a blank Googling for this... Our website homepage shows a grid of featured image thumbnails on the home page. Some of these images are portrait and some are landscape. I would like to be able ...
0
votes
1answer
58 views

Automate WordPress website setup with prefilled data

I'm asked to write documentation explaining how to set up a website to run exactly as the live environment does right now. The website is dependent on WPML, certain categories and menu's being ...

1 2 3 4 5 20