Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [get-option]

The database of a WP install contains an option table that is used for settings both of WP core itself and of plugins/themes. The `get-option()` function retrieves a row from this table

0
votes
0answers
23 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 ...
1
vote
1answer
52 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
54 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
32 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....
-1
votes
2answers
61 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
45 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
27 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 ...
0
votes
1answer
36 views

WP options plugin setting not saving the selected checkboxes

I am trying to make a plugin, so far everything is working, the problem is when its time to "save changes" the text are saved but the selected 2 checkbox didnt save so both remains unchecked. Heres ...
0
votes
0answers
31 views

Show echo ready in single.php

this code works correctly. But how to display <?php echo $quote; ?> on single.php? It only appears inside the user profile page. Do I need to display In single.php function ...
0
votes
1answer
43 views

how create an html table with all values from a serialized array in option_value

i am very new to wordpress and i have dived in deep waters in other peoples code :(. so i have this data array as an option_value in wp_options table a:2:{s:16:"block1_names_arr"; a:7:{i:0; s:6:"...
9
votes
2answers
828 views

Is get_option() faster than accessing get_transient()?

Today I run a test over my db to explore the speed difference between accessing a key from options, custom table & transients. I ran the test for 1000 times and following is the time taken to run ...
0
votes
1answer
50 views

Echo custom admin field into a is_single()

I hope you can help! I have created a relatively simple admin settings page, that has 3 fields: page IDs, post IDs, Text Box What I want to do, is display the HTML content of Text Box at the top of ...
0
votes
0answers
33 views

Protect WordPress option value

I'm working on a plugin and users need to create and store some unencrypted credentials in wp-options. The credentials in question are service keys for google server to server API which is just a json ...
0
votes
1answer
94 views

Problem with display data from get_option

I have a problem with get_option function. I created options page with one field for testing in form. Everything saving data to database, but when i try display it i getting "Undefined index", but ...
0
votes
1answer
28 views

Security for data obtained from the database

I am getting information from the database to show it to the user, example: $data = (get_option('config')) ? get_option('config') : false; I need to display this data when loading the webpage, ...
0
votes
2answers
598 views

Custom general settings (textarea field) don't output HTML correctly

I add my custom fields in genearal settings page. One of them using Wordpress Editor - there i insert my HTML content. I creeated it using simple snippet: add_action( 'admin_init', '...
0
votes
1answer
153 views

Get Link of Page Selected through a Select Field in Custom Admin Page

I've created a list of pages in the backend of a Wordpress site using wp_dropdown_pages();, which of course shows a dropdown of existing pages. What I'd like to achieve is retrieving not the name but ...
4
votes
2answers
310 views

Conditional Logic to Check for Site Icon

From what I've read (Check if Favicon is set in Customizer and others), it appears checking to see if a site icon is set in a theme should be easy. It doesn't seem to be working for me. I'd like to ...
0
votes
1answer
498 views

How to See Everything in get_option()?

In theme and plugin development I like to completely run through everything to make sure there are no issues and I'm not getting any errors. ONLY in development do I add the following in my footer....
0
votes
0answers
1k views

Showing get_option( 'page_for_posts' ) or View all posts link is not working in wordpress

I am trying to show view all post with this link <a class="btn-primary" href="<?php echo get_permalink( get_option( 'page_for_posts' ) );?>">View All</a> It directing the correct ...
-2
votes
1answer
308 views

If Home Page Do Nothing, If All Else Show This Content

I have this code: <?php if (is_single() || is_page() || is_archive() || is_404() || is_tag()) { ?> <div class="single-page-title"> <div class="spt-wrap grid-container container grid-...
2
votes
0answers
244 views

get option framework options returns Call to undefined function of_get_option()

I have this kind of twitter feeds fetcher and as the twitter API requires consumer key, consumer secret, access token, access secret so I created those fields using option framework in my theme and ...
1
vote
0answers
27 views

How can i send multiple value using get_option(); [duplicate]

If suppose I have :- function dr_add_adminp() { // Generating dr_theme_options Admin page add_menu_page( 'USR THEME OPTIONS', 'User Options', 'manage_options', 'theme_options', 'theme_page', ...
2
votes
3answers
9k views

Select dropdown not showing selected value php

I'm using Wordpress Settings API. Everything works as it should except this select dropdown. When I select an option, the value echoed is correct but in the dropdown it displays the default first ...
0
votes
2answers
84 views

FATAL ERROR - white page - no site showing

This is the message that I got shortly after I clicked on the option to upgrade to the newest version of Wordpress. I made the mistake of NOT backing up my files somewhere and now I am wondering if I ...
2
votes
1answer
631 views

Set a Default Value for an Option?

Does Wordpress have a way to set a default value for an option? That is -- I know get_option accepts a second parameter, and will return that parameter if no value is set. For example, when I'm ...
2
votes
1answer
2k views

Why does get_theme_mod return blank (or default value) but get_option returns saved value?

Why does get_theme_mod return blank (or the default value if specified) but get_option returns the correct (saved) value? I have a colour picker in the customizer color-primary which functions ...
0
votes
3answers
65 views

Plugin Options Array Set to Undefined

I want to set a number of plugin options set to blank if they are not defined so I can avoid the PHP notices. What is a better way of writing this code? $options = get_option('plugin_options'); // ...
1
vote
1answer
33 views

Pass current post title to a predefined link

I have custom link option which I show on all posts using: <?php echo get_option('_custom_link'); ?> and let's say, I have defined it with a URL value of http://somelink.com/?ref=...
0
votes
1answer
94 views

Display user HTML on website

I have a settings page in Wordpress that lets the Admin enter HTML Code. I want to display this code at a specific page on the website using a shortcode. My problem now is that the shortcode displays ...
0
votes
1answer
149 views

Plugin option for input box validation

I'm crating a plugin option page from the code below. However, it does not explain how to get validation on the input fields. How do I get validation on id_number for NUMBER ONLY? https://codex....
0
votes
1answer
71 views

Getting all the settings for a plugin

Looking at the Settings API and you can register new setting using register_setting() but I can't find a way of getting all the settings for a certain plugin. Let's say I want to get a list with all ...
1
vote
1answer
866 views

Wordpress get_option and update_option returned entered on the textbox field

I do have a problem regarding the plug-in settings that I've made. I've created a simple textbox and a submit button and run it on the admin page setting. The name of the textbox and submit button is ...
0
votes
1answer
207 views

Custom setting field value not working inside add_action init hook

I have added custom setting options page under WordPress settings and those are working perfectly. I have tested their values also. But when I am using those values inside function file within ...
0
votes
0answers
1k views

Dynamic value for get_option linked to taxonomy term_id?

I'm saving info into "get_option" and it's working great. But the info I'm saving is the slug of a custom taxonomy. The problem is that if I change the slug of the custom taxonomy later, it doesn't ...
2
votes
1answer
497 views

How can I get all user options?

The codex has a function called get_user_option() but it requires me to pass the name of the option. Is there a wp function to retrieve all user options? I just need to see a list of all options set ...
0
votes
1answer
711 views

get_option return incorrect values

I'm making a Wordpress Plugin, and I'm starting with the Admin Settings page, I have the page setup and in the menu bar, i have also added sections and fields in to the page and they all work fine, ...
0
votes
1answer
21 views

Including a custom options page causes “Pages” to disappear from dashboard menu

I've created a custom options page and referenced it through my functions.php file. When i do this, the Pages option is removed from the WP dashboard, almost as if overwritten by the new options page. ...
1
vote
1answer
3k views

get_option() is not working even db contains the corresponding option_name and option_value

First of all, this is not a plugin specific problem. I wonder why this might happen? I am using @bainternet's Tax Meta Class for saving Taxonomy Meta using the options table. I uploaded my contents ...
0
votes
0answers
184 views

get_option returning old value for non-admin users

I am working on multisite with sub-folders. I am trying to create a plugin that will simply reduce the click counts and those counts will be visible to all users. For admin user all is working fine. ...
2
votes
1answer
5k views

get_option function

I'm currently trying to make my own theme, but i'm not quite sure how the get_option() function works, because how come this.. echo get_option('show_header', 'sultenhest_theme_display_options'); echo ...
0
votes
1answer
612 views

Wordpress get_option() on AJAX issue

I am having some issues with the get_option method in Wordpress. I'm running a WooCommerce website and for the currency symbol position is set to "Right with space". In the wp_options table the ...
1
vote
1answer
707 views

Get plugin option in another PHP file

I making a plugin, and I registered several options in the plugin PHP file. So let's consider : my-plugin/ - my-plugin.php (options are registered here) - admin.php (the admin page of the ...
0
votes
1answer
3k views

get_option() will not work without access to wp-config.php

I've created a plugin. In the initialisation file of my plugin I created an options page with some options to be stored by the admin. <form method="post" action="options.php"> <?php ...
0
votes
2answers
221 views

get_option and list of options

I'm trying to retrieve some values stored in the option panel of WordPress, however the list of the options I found on the site seems not complete. Perhaps it's me looking in the wrong place. What ...
5
votes
1answer
2k views

differences between behavior get_option vs get_site_option in multisite

I am converting a bunch of sites to multisite and I am confused about the behavior differences between get_option and get_site_option. It appears that get_site_option actually means "...
15
votes
4answers
15k views

get_option() vs get_theme_mod(): Why is one slower?

I've been using get_theme_mod() for some time in various projects of mine. I decided to take advantage of the Theme Customization API in WordPress v3.4 once it was available as I felt it was an ...
3
votes
1answer
2k views

Using update_option() and get_option() is echoing escaped strings

I'm using the Option API for my theme settings page. I use the $_POST data to update the options when the changes are saved. My issue is that the strings I send get escaped and when I use this code: ...
0
votes
3answers
1k views

get_post_meta fields don't show up on posts page

I'm new here, and to coding! I've been working hard (so, so hard...so hard) to create my website and with occasional help I've created a look and feel I like using some custom get_post_meta fields for ...
0
votes
1answer
128 views

Echo option page form field value

Here is my option page code containing a no of fields like logo, slider after filling all the information in option page form. I need two things After submitting all the form details save ...