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
1 answer
14 views

When to store store plugin options as a single database record?

I'm building the analytics script plugin which offers customizations on a settings page. There will be around 20 options in total. Does it affect the performance negatively if I manage these 20 ...
Ostap Brehin's user avatar
0 votes
0 answers
9 views

Wordpress keeps redirecting to root site after saving any setting

we have the next issue: We are working in our DEV environment: www.oursite.com/blog But everytime we press the "save settings" button, for example, saving changes inside settings/general it ...
JPD's user avatar
  • 13
0 votes
0 answers
18 views

To many WooCommmerce related transients in WordPress options table

I have the following problem on my Wordpress installation. There are too many, hundreds to thousands of transients in the options table. And the options table grows and grows and grows. If I don't ...
ossicom's user avatar
0 votes
1 answer
31 views

Secure way to add JS Script to Wordpress filesystem

EDIT: Because of the answers below i changed the title and explanation for this question. Maybe there are other people who struggle with saftey questions, like me. I am a beginner with Wordpress ...
LovinQuaQua's user avatar
1 vote
1 answer
50 views

Moving uploads directory above wordpress directory. UPLOADS location in parent directory

I will ask for help as I'm going nuts trying to figure out what is going on here. I've read many other questions but there is never a final answer. I want to organize my WP installation in a different ...
Gerard Reches's user avatar
0 votes
0 answers
6 views

Unable to change blog language in multisite

tl;dr No matter what I select in Site Language: After hitting Save this value is always reset to English (United States). Where or what should I be looking for to resolve this? I was playing a ...
trejder's user avatar
  • 322
1 vote
2 answers
34 views

What is the real purpose of the parameter $option_group in the function register_setting()?

We have the following register_setting() function from the Settings API: register_setting( string $option_group, string $option_name, array $args = array() ) I get what the $option_name and the $args ...
Gerard Reches's user avatar
0 votes
2 answers
59 views

Ignore "empty" fields when saving

My WordPress and PHP knowledge is limited, but I am working on a plugin, and in the admin page I have three settings - two text inputs and one checkbox. On save, the values are stored in the ...
mjlu's user avatar
  • 3
0 votes
0 answers
60 views

Custom Block: Adding "Post Type" dropdown to Sidebar Settings

I'm pretty new to React, so I'm trying to find the simplest and most PHP-based way to achieve my goal. What I've accomplished so far Created custom blocks using the @wordpress/create-block package. ...
beat's user avatar
  • 43
0 votes
0 answers
8 views

What setting can I change as my email forms don't work with some phones or ESIMs?

I have tried lots of different things but can't get email working from subdomains. If I use something like CF7 the little wheel just keeps spinning for some people in Japan using ESIMs or VPNs from ...
Glen Charles Rowell's user avatar
0 votes
2 answers
233 views

Why wp_load_alloptions() fetches all options if no options is set to autoload?

The wp_load_alloptions() function in option.php file, loads all options if no options is set autoload=yes Why does it do that? function wp_load_alloptions( $force_cache = false ) { global $wpdb; ... ...
p4atik's user avatar
  • 3
2 votes
2 answers
42 views

Does WordPress automatically redirect to the URL specified in settings?

My WordPress site used to require htaccess rewrite rules to redirect non-www to www (or vice versa) and http to https. Without those rules, the site would be accessible at whatever URL the user ...
Dave's user avatar
  • 119
0 votes
1 answer
39 views

Theme / Divi change visitor css and site logo and all site urls based on REQUEST_URI non logged in wp user

I am trying to store the baseurl to options table in wordpress for non logged in users. Basically if the user was referred to url mysite.com/go/affilatename I want to store affilatename (baseurl) to ...
GURU mcewan.marriott's user avatar
0 votes
1 answer
607 views

Add "/blog/" as base for all blog post URL

I want to add /blog/ as base for all blog post URLs on my website. Only issue is, I already have a page with the permalink as /blog/. So now the permalink settings are not allowing me to update as /...
aslamdoctor's user avatar
0 votes
1 answer
21 views

What is the equivalent of get_user_option for saving options?

In a custom plugin, I want to save user interface settings (e.g. which sections are expanded/hidden). From what I see, the get_user_option (docs here) function is perfect for retrieving the value. ...
hbit's user avatar
  • 230
0 votes
0 answers
303 views

How to disable the PDF preview in the file block by default

when I insert a PDF file with the file block on the page it always opens to me with the preview of the file with the pdf viewer, so I have to put the check to disable it. Is there a way to have that ...
LesCa's user avatar
  • 21
0 votes
0 answers
17 views

Multiple plugins settings of same developer into ONE settings page linked together

Im quite new to wordpress and plugins. I'm still a student so im still in the learning curve. Thank you in advance for reading my question CONTEXT Each plugin is a plugin on its own but made by the ...
MiYuKuro's user avatar
0 votes
1 answer
545 views

How to figure out correct wp_options to have autoload='yes'

I have a website that has suddenly become slow. I don't know what caused the change. I haven't installed new plugins, and I don't think I recently updated any plugins. Upon inspection with Query ...
Peter Ajtai's user avatar
0 votes
0 answers
89 views

move setting data from wordpress api to codestar freamwork

I am coding a plugin that uses the Star code framework It should be mentioned that I had written this plugin using WordPress API before. Now I want to integrate and make it more advanced, but I ran ...
masoud nkh's user avatar
0 votes
1 answer
61 views

Settings API not Saving to Database or Display

I am developing a payments gateway, and wanted to have a page with a form to save authentication credentials for reaching out to an external API used for payment. I made a settings page using ...
Evan Kirschenmann's user avatar
0 votes
0 answers
84 views

How to add custom settings to the menu of custom post types?

Not sure if this has been asked before. But how can we add custom settings to the menu of custom post types? Or add custom fields for an entire post type and you can edit them? For example: This is ...
Run's user avatar
  • 331
0 votes
0 answers
153 views

save array of objects with update_option

How do I save an array of objects in Wordpress/PHP via update_option ? What I'm trying to save is something like: update_option('my_option', [ { 'c': htmlspecialchars($_POST['hidden_category']), ...
Nathan Bernard's user avatar
0 votes
1 answer
36 views

How to access values from your own settings page in javascript?

I added may own settings page for my plugin with php. Furthermore I need to access the values from two inputFields from the settings page after someone clicks on a submit button on the public page. My ...
bn 41's user avatar
  • 1
0 votes
0 answers
26 views

Neither update_option nor delete_option fires in deactivation hook

I have a plugin. And the following code: function activate_my_plugin(){ // my_option value here: 1 update_option('my_option',0,true); // I've tried with and without last parameter // ...
dgo's user avatar
  • 125
0 votes
0 answers
287 views

Color Picker UI in admin is not correct

I need to have color picker settings filed in my plugin. I have registered a field and its saving value in the database correctly. But, in the admin area the picker user interface is not correct I ...
Akramul's user avatar
0 votes
1 answer
28 views

Change in one place the data about the company, which are placed on several pages [closed]

Some pages of the site contain information about the company. If something changes, then you need to change everything manually. Is there a way to change the data in one place and it will change ...
Veronika Jefimova's user avatar
2 votes
0 answers
1k views

Add a custom WooCommerce settings tab with sections [closed]

I'm trying to add a custom settings tab to the WooCommerce settings screen. Basically I want to achieve a similar thing to the Products settings tab, with the subsections/subtabs: I haven't been able ...
AJT's user avatar
  • 187
2 votes
2 answers
58 views

How to show every second user different types of banners?

I have to create the next feature fore the project: We have two type of top-bar lines. We need to show every second user(or user session I think it's more easy) different types of banners. Okay I ...
Victor Sokoliuk's user avatar
0 votes
1 answer
84 views

Serving Images from subdomain in wordpress

This is my current image url https://example.com/wp-content/uploads/2022/06/sample.png served via cloudflare uploads folder is in my wordpress installation I am syncing the uploads folder to Backblaze ...
kgill's user avatar
  • 1
0 votes
1 answer
28 views

wp_options not returning value for logged out users?

I have saved my custom plugin settings inside wp_options table, but when I try to access them using "get_option" function it returns me undefined for logout users, but when I logged in it ...
Talha Arif's user avatar
1 vote
1 answer
63 views

save_post_{CPT} not updating the 'sticky_posts' option

add_action( "save_post_{CPT}", 'update_sticky', 15, 1 ); function update_sticky( $post_id ) { $stickies = get_option( 'sticky_posts' ); if ( ! in_array( $post_id, $stickies ) ) { ...
Tahi Reu's user avatar
  • 236
1 vote
0 answers
59 views

How to get specific setting by settings_fields()?

I am working on a plugin and on the settings page I have 2 settings and I want to show Only one setting "backgroundColor" so how should i do that? This is the code: <form action="...
kovrita is The life's user avatar
0 votes
2 answers
2k views

Check if an option exists and get its value in one hit

I have an option admins_settings that has an array of sub-options that is stored in the wp_options table. Before I get its value from the table, I check if this field exists by running this code: if ( ...
Jaafar Abazid's user avatar
0 votes
0 answers
32 views

get_site_option / update_site_option - the main site and sub sites do not share the same storage

get_site_option / update_site_option is supposed to get / update an option for the current network (contrary to its name). I have noticed that it works only for sub-sites, all sub-sites share the same ...
Maciej Kravchyk's user avatar
2 votes
1 answer
964 views

The Settings API - What is the purpose of default value in register_setting?

I'm trying to wrap my head around the Settings and Options APIs as I'm writing a simple plugin. One thing that has really stomped me is the possibility to add a default value to an option when calling ...
Tomas Eklund's user avatar
1 vote
1 answer
423 views

How to get bool with `get_option()` when already registered setting with type `boolean`

When I register a boolean setting using register_setting() I already pass the data type: register_setting( option_group: '…', option_name: '…', args: [ ...
David Wolf's user avatar
0 votes
0 answers
339 views

get_option() and update_option() in a transaction (for an autoincrement value)

I need an autoincremented ID for a custom post type to manage order IDs. For this, I would use the WP Options API, but I'm afraid of a typical transaction issue: $count = get_option('my_id'); ...
remy's user avatar
  • 1
1 vote
0 answers
92 views

Settings API not saving values to database

Here is what I'm attempting to do: I have two fields called Client ID and Client Secret. I would like to save each individual item in the database as the following keys: instagram_client_id and ...
Sema's user avatar
  • 11
0 votes
1 answer
10 views

How does one update complex options?

I'm using Tom McFarlin's WordPress-Plugin-Boilerplate along with JoeSz's Tutorial. I'm loading in a complex options item using $options = get_option($this->plugin_name); This works fine for the ...
bugmagnet's user avatar
  • 101
0 votes
1 answer
14 views

How to change color of a word in text after WP update

Since the latest WP update it changed my setting. Normally I had a ''change text color'' setting in the red area (see screenshot). Anyone can guide me how to add the option in this field?
Jim Reuters's user avatar
0 votes
1 answer
48 views

Elementor - Edit Global Colors Order

I'm trying to change the order of the Elementor global colors list. This question was originally posted here, and while the instructions are thorough, I can't find the elementor_page_settings in the ...
IMTanuki's user avatar
0 votes
1 answer
28 views

display category name based on its equivalent id

I have a theme with options. I would like to display 3 posts for a specific woocommerce category, I could show category id and I don't know how to display products based on its category id, but I have ...
latif tahta's user avatar
0 votes
1 answer
187 views

Native timestamp on wp_options option

Does anyone know if the wp_options table have modified timestamps for their options? I have an option that has an object as the option value as shown below: The "Access Token" within the ...
theMap's user avatar
  • 25
0 votes
0 answers
259 views

Managing and deleting transients with dynamically generated transient names

Let's say I have access to a remote API that stores car data, and I want to be able to place car information box(es) into posts using a shortcode. The shortcode fetches JSON data with wp_remote_get() ...
ddriver1's user avatar
  • 101
0 votes
1 answer
122 views

Multisite Equivalent of `register_setting`?

Working on converting a custom plugin to run in multisite. I want the settings to apply globally, not per-site. I've converted all of the get_option calls to get_site_option and the equivalent for ...
James K.'s user avatar
  • 101
0 votes
1 answer
190 views

How to Edit the Order of Global Colors in Elementor? [closed]

I looked all over for a solution to changing the order of the global colors in Elementor, but didn't find one. People have asked how to do this both in Elementor's forum as well as reddit and a few ...
Pegues's user avatar
  • 157
1 vote
1 answer
1k views

How to set Gutenberg preferences programmatically with wp.data.dispatch?

The Gutenberg Options > Preferences menu contains a number of additional settings to customise the Gutenberg experience. The default GUI is shown below. I would like to programmatically enable the ...
jla's user avatar
  • 133
0 votes
0 answers
17 views

What is the XSSAttack option_name for in the options table?

I am working on eliminating malware from a site and reviewed the entries in the options table. Found an "option_name" of XSSAttack with an "option_value" of 1. Lots of searches on ...
Brad's user avatar
  • 1
1 vote
1 answer
130 views

SQL QUERY - Select a value directly from the database

In my WordPress database, in the options table, there is a field in the option_name column which is called titb_flc_options, whose value is this: s:397:"a:10:{ s:16:"69c3d01e88aba503&...
Marco Dedo's user avatar
0 votes
0 answers
29 views

Using shortcodes in the Site Title

I'm using MetaBox for a settings page with custom fields. I'd love to be able to use their shortcode to pull custom fields into and used as the Site Title. Does anyone have any ideas on how this or ...
Scooter's user avatar

1
2 3 4 5
22