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
votes
2answers
15 views

selecting options from another form

Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version ...
0
votes
1answer
7 views

Is there a standard technique or API for getting the site header image?

There is this function: get_header_image() which can be called from within WordPress. Is there a way to access this externally, i.e. from the API? The use case might be a header for an external RSS ...
0
votes
1answer
28 views

Changing the CSS with a plugin

I'm trying to make a plugin that changes the CSS file. My client want to change the colors each season, and we want to make it foolproof so they won't break anything. I've managed to create the option ...
1
vote
2answers
29 views

Where does WordPress store plugin (enabled/disabled) status for multisite?

A recent update to one of the plugins I use broke my multisite blog and in the process of debugging it, all of the plugins got disabled. Now I have to try to figure out which plugins used to be ...
0
votes
0answers
11 views

custom options are saving values to settings page, but fields do not exist in options.php

I have added an option to a custom settings page with: add_settings_field( 'ev_mission_select', __( 'Mission:', 'wordpress' ), '...
0
votes
0answers
16 views

How to submit the settings api data by ajax on theme options page

Instead of reloading i need to submit the data by ajax. it is because theme options having customized tab sections and all the fields are in array in a single field of settings api. //Displaying and ...
0
votes
1answer
28 views

Upload file on pre_update_option_{option_name}

is there a way to upload a file while saving options in WP ? I have this option setting (save is binded to options.php) and need to upload and store a file on server and cannot find the file in ...
0
votes
2answers
92 views

How to save custom settings api fields with custom section fuction

I am creating wordpress theme on a single options page. I have customized the default do_settings_fields and do_settings_sections functions. my fields are displaying fine but when i am trying to save ...
0
votes
2answers
58 views

Huge wp_options table

I have a problem on a WP site. Website crashes because there is no more available disk space. Searching, i detect that wp_options table size is 12GB, but only have 1100 rows aprox: Any ideas? Thanks ...
1
vote
1answer
28 views

Setting 'autoload' to 'no' with Settings API

I've looked at the Settings API codex page, https://codex.wordpress.org/Settings_API, and I can't find anything related to setting autoload to no for any options using the Settings API. Is there any ...
0
votes
0answers
20 views

Help to create the best plugin settings!

Can you help me about how to create the best WordPress settings for plugins? I have a custom setting page and I need to create some field with WordPress API. Actually I use this solution: https://gist....
0
votes
1answer
11 views

Move website from root to sub

What am I trying to do exactly ? Move my WP website available at example.com to example.com/subdir but I don't want to make it available on example.com Why would I want to do such a thing ? I want an &...
1
vote
1answer
37 views

How to update_site_option for specific site within network?

I would like to add or update site options (like those shown in the screenshot) using update_site_option, but I have no idea (1) how to choose the correct site by its id? And where do I find the ...
1
vote
6answers
393 views

WordPress automatically created files like .theme-name / .plugin-name.php [closed]

I noticed that in every single folder of my wordpress there's a file called .theme-name.php. For example, in the theme folder twentynineteen.php there is this file called .twentynineteen.php This is ...
0
votes
0answers
39 views

WordPress Settings API Overrides My Previous Value

I have created the following custom menu page to save some data, I've included some repeatable fields inside the form. The problem that I have is that every time I click the submit button it overrides ...
0
votes
1answer
23 views

What structure and database storage method should I use for temporary storage that may be written concurrently?

In working with a third-party API, I need to store some state information to help track a process. I'm wondering where and how I should store it. Specifically, I have a multi-page Gravity Form, and ...
0
votes
2answers
32 views

Multiple Address In WP-Option Value

I've tried to setup my wordpress using 1 domain name and 1 ip address, after this, all the css is missing, but the site still can be accessible using both domain and ip address. Then I tried to ...
0
votes
0answers
14 views

Post settings meta widget in the frontend

I'm using Wordpress 5.4.1 with the MasterStudy LMS Theme/Plugin and the "Groups" plugin (https://wordpress.org/plugins/groups/) With the Masterstudy plugin I can create courses from a frontend page, ...
0
votes
0answers
16 views

Form input values are empty after submit

I'm trying to build a settings page for my WordPress theme. I have created the following form which includes repeatable input fields. Everything is working except when I submit the form and refresh ...
0
votes
0answers
13 views

Make regular pages appear like Homepage with “your latest posts”?

I want to have what would appear if I chose "homepage display to: Your latest posts" but on a page of my choosing. i.e. on my front page I have all recent posts. On a certain category page I will have ...
0
votes
0answers
17 views

Encoding matter - ? instead of € after settings field callback

In my plugin I have som classes to manage settings field. For some reason in one moment the setting field value with special characters like 30€ in textarea or input[type=text] change to be 30?. I got ...
0
votes
0answers
8 views

Unidentified plnTokenForOrder_nnnn option in wp_options

I have hundreds of plnTokenForOrder_[0-9](4) with autoload in my wp_options table and I really don't know where it comes from. Could it be linked to Stripe or Paypal gateway? How can I be sure it's ...
1
vote
1answer
31 views

Settings API get_option best practices

I have a lot of options in my custom theme and most of them are like: get_option('my_option')['depth']['more_depth'] as they are arrays. In order to write code in a "cleaner", more compact way I have ...
0
votes
0answers
17 views

Load google font script based on optgroup label selected

Ive searched and can't find an answer. I have two groups of fonts - one regular fonts and one google fonts. Im using a select dropdown list with two optgroups, one for each group of fonts. What Im ...
1
vote
1answer
49 views

get_option array value defaults and best practices

I have a custom options page. I have several sections of settings and some of them are even more closely related to each other so I decided to store them in arrays, seems more logical to me. It surely,...
2
votes
1answer
53 views

Custom theme options Radio inputs not saving

Why isn't the following option getting saved? Have been searching for quite some time and can't get it to work. Settings code: add_settings_section( 'aa_myoption_section', null, null, 'mypage-...
2
votes
1answer
54 views

Is it ok to call get_option without hooks?

Many plugins call get_option() to fetch their settings right in the main plugin file, without using any action hook. Is this the way it is meant to be used? I am asking because it seems to me that ...
0
votes
0answers
21 views

Custom theme options display specific section and saving problem

I have a custom theme options page with multiple sections and fields. What I cannot figure out is how to display specific sections at specific places and in addition if there are 2 or more sections ...
1
vote
1answer
31 views

Correct way to output styles gathered from theme or plugin settings?

I have built a Timeline plugin and used Carbonfields to add a settings page in which users can select the colours of each element in their timelines. The plugin has default colours in the main ...
1
vote
0answers
17 views

Display post option on frontend

Don't know better way to describe. Is it possible & how display this module (red marked) on frontend?
1
vote
0answers
25 views

How to automatically set 'default image size' for specific Custom Post Type

I'm looking to automatically set the default image size in the WordPress WYSIWYG, but only on certain Custom Post Types. For example, my CPT 'products' would default to 'medium', and CPT 'staff' would ...
0
votes
0answers
22 views

wp_options in multilanguage web site

I am trying to create a multilanguage supported template in WordPress. But I have a issues about options. I am using the WPML plugin. I am creating options like this: register_setting('mediaport-...
1
vote
2answers
242 views

Serialized settings in rest api

I have registered settings and need it to be showed in REST API. $args = [ 'show_in_rest' => true ]; register_setting('default_sidebars', 'default_sidebars', $args); When I save a single ...
1
vote
1answer
166 views

How to set “Site Address (URL)” programmatically on WP multisite?

I have a new WP multisite configured to use subdomains by default. Network sites are created programmatically when the user signs up. I want to give the user the option to enter a custom domain and ...
0
votes
1answer
30 views

Decimal values via get_option() with custom local (decimal point = comma)

I have a tricky bug in a plugin and I'm trying to figure out who's fault it is. The plugin uses in its init method a check if the DB has to be updated. And the child theme I'm using has set a custom ...
0
votes
0answers
14 views

Multi select plugin options: Only one value is saved [duplicate]

At the moment I'm stuck with a multi select option for my plugin. I took one of my working select callbacks and added multiple="multiple" to it. Doesen't matter what I'm selecting only the option ...
0
votes
1answer
25 views

Change permalink structure in all sites of a multisite

How could to modify the permalink structure in all sites of the multisite at once?
0
votes
1answer
56 views

get_option / wp_localize_script Not Working in OOP Plug In

Got this working the other day in a single-file php plugin which only consisted of functions. Now I am trying it out with the WordPress Plugin Boilerplate which is an OOP approach with a lot of ...
0
votes
1answer
32 views

How to save Checkbox-Options in Plugin Options Page

First of all: I am really a newbie. So I used a template for my options page and tried to customize it (works pretty good so far). About my plugin: It creates to post types and some meta boxes ...
0
votes
0answers
36 views

Image upload in custom theme settings page

I need to upload a logo image and set other options on a custom settings page. I can't retrieve the URL and upload the custom image, what is wrong with my code? <?php /*** New menu item ***/ ...
0
votes
1answer
18 views

Where does this field get its value?

I've inherited maintenance of a wordpress site with a custom template. I'm trying to change the value of a phone number that is displayed throughout the site. I've found the field by looking in the ...
1
vote
2answers
24 views

WordPress setting with select - where is my mistake?

I have two option callbacks in my plugin, one with a ckeckbox and one with a select field. The first one is working perfectly, the second not. The select field doesn't save its value. I double checked ...
1
vote
0answers
29 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
49 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
23 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 ...
1
vote
0answers
15 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
199 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
17 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
25 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
2 3 4 5
20