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
44 views

Editing a loaded Wordpress option without updating the database

Is it possible to edit an option such as the page_on_front setting in a local scope, without updating the option in the database? For instance, I am attempting to serve a different homepage to logged ...
0
votes
1answer
852 views

Adding a checkbox field to a (custom) taxonomy

I've searched and found many variations on adding custom meta to taxonomies - often its just for text fields and often to store a whole array of options. One thing I haven't found is a way to ...
1
vote
1answer
382 views

How to make get_theme_mod work with AJAX in the customizer preview

Is it possible to make the get_theme_mod work after refresh in the customizer preview pane when it's being called inside a template part by AJAX? I have a theme that loads the posts on scroll (...
0
votes
1answer
29 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
0answers
25 views

Registered sidebar area is not shown from plugin.

I am trying to list all registered sidebar. But while I put the code inside plugin it does not work but if I put it inside theme it works. function chup_list_sidebar(){ $sidebar_options = array(); ...
0
votes
1answer
92 views

Override plugin option by with a custom theme

I'm creating a custom theme and using one of video embedding plugins from the market. There are plenty of options and among them "don't load css style", is there a way how to make it always checked ...
0
votes
2answers
87 views

Can I use register_settings and unregister_setting once the settings page has loaded?

I want to add few settings fields dynamically on settings page depending on user action. I am planning to register these new fields dynamically once user asks for it and show the corresponding HTML ...
0
votes
0answers
1k views

add image in dropdown select

if (!function_exists('dropdown_categories')) : function dropdown_categories($show_option_none, $name, $selected = '') { if (of_get_option('blog_cat_id')) { return apply_filters('...
0
votes
1answer
24 views

Settings API and 'type' => 'font'

array( 'name' => 'textarea', 'label' => __( 'Textarea Input', 'wedevs' ), 'desc' => __( 'Textarea description', 'wedevs' ), 'placeholder' => __( '...
0
votes
2answers
788 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
2answers
88 views

Update WP option by plugin

I wanted to set value of WP option (more specifically - 'admin_email') by using plugin, its option (plugin option) and update_option(). I tried using lines like below, but when plugin code contains ...
0
votes
1answer
253 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 ...
1
vote
1answer
323 views

How can I make my options in an array and store theme in WP options one DB row?

I am making a theme with theme options but for customization, I have completed my theme options more than half. Suddenly I have triggered one problem and that is I have checked my wp_options DB I have ...
0
votes
2answers
812 views

add_settings_error on validating plugin options API

I am developing a plugin which uses options API. I defined a class that uses a function to sanitize the inputs, but when I submit the options form, It displays errors and info twice. And also I didn'...
0
votes
1answer
1k views

How to save plugin custom settings page fields

I want to implement a plugin which gets 2 fields in admin area and saves those in options as array I read the page Custom Settings Page but seems it doesn't describe how to save fields values in ...
0
votes
1answer
357 views

Category URL to use same string as Post URL Permalink

I want to set up my site to have the following permalink structure: /learn/%category%/%postname% So in the permalinks section of wordpress, I set that as the custom structure. The issue is, when I ...
1
vote
1answer
226 views

Work flow for multiple developers

I'm looking to streamline the development work flow for a new project that will have multiple developers involved (backend and frontend). My biggest quandary is how best to make sure all devs have ...
0
votes
3answers
138 views

How can I style my theme admin page?

I made a large-scale research. But there are no anything what I want. I want to style my options page in a static style file. How can I do that? Sources /* *Create A Simple Theme Options Panel *Exit ...
0
votes
1answer
85 views

Possition a Custom Post Type Tab under Settings

So i would like to ask if there is any supported Wordpress way of positioning the CPT menu tab under the settings. Thank you!
1
vote
1answer
181 views

Storing product price data in the database

I am writing a Wordpress plugin to store product data that is pulled from the Amazon Affiliates API. My goal is to have an admin page where I can add new products and view/edit/remove existing ...
0
votes
0answers
35 views

How can I change the default image behavior?

I would like to set the images in my blog to default to the large size, and clicking on them will perform the "Media Link" option. I could set this up every time I include an image in my blog, but I'm ...
0
votes
1answer
207 views

problem with get_option in dashboard

I have created simple plugin which transfer the html code from text-area in dashboard to front-end page where function defined in the plugin is being called to render the front page. However i have ...
0
votes
1answer
24 views

why my wordpress dont have toolbar like, plugin, themes and other?

why my wordpress dont have toolbar like, plugin, themes and other ? thet is screenprint of my wp.
1
vote
0answers
396 views

Options API get_option() and update_option() Not Correctly Updating or Returning

Consider the following code: if(!class_exists('Update_Option_Error')){ class Update_Option_Error { public function __construct() { ob_start(); // This ...
0
votes
1answer
162 views

update_option does not work in this scenario - how do I fix?

I am attempting to use update_option to add or update an option. I have created a test below which creates a settings page and when loaded it runs my awd_do_sync function, but the option does not get ...
0
votes
0answers
238 views

Register setting on plugin activation

I want to register an option when my plugin is activated to be used in the settings page. My first attempt: function jpsNews_activate_plugin() { // REGISTER SETTINGS register_setting( '...
3
votes
2answers
431 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
0answers
59 views

Post being duplicated with foreach loop

I am trying to create posts from options in the database, but I am getting duplicates of the posts each time I run the function even though I have added a conditional to check for duplicates. Here is ...
1
vote
1answer
88 views

Store regex expression in Wordpress DB using Options API

I have been searching all afternoon for a solution and couldn't find one. I am writing a plugin which needs to store regex expressions in the WP DB. An example expression is the following. /(http:\/...
1
vote
1answer
147 views

php page not found for plugin options menu

I'm trying to make an options page for a plugin and i'm getting The requested URL /site/wp-admin/plugin-email.php was not found on this server. every time i press 'Save settings'. Here is my code: ...
2
votes
1answer
158 views

How to default all users to no link for attachments?

My site has image attachment pages disabled through Yoast SEO, but some of our content editors frequently insert images with the option of Link To: Attachment Page. If I speak to them individually, I ...
3
votes
2answers
312 views

WordPress customizer: load controls in a custom div

I have a custom div (holder for extra settings) which I need to load some specific controls from a specific section in there. I can get the controls in JavaScript but I can't generate the necessary ...
0
votes
1answer
532 views

Which action hook to update custom field at network/site-info.php in multisite on update site info

I am currently using code to add a custom field to the site-info.php & site-new.php in the network admin management to add a custom option to the database, this does work when I create a new ...
2
votes
2answers
804 views

Editor role not saving settings page for custom post type

I currently have a custom post type with a sub menu page via add_submenu_page. On this page I have a form with some basic settings such as a text editor and some radio buttons. function ...
0
votes
0answers
119 views

Change database image location for transportability

The problem: the worpress site is developed locally by my team. When we finish, we will put it online. Now, changing the siteurl, home and ossdl_off_cdn_url in the database table wp_optionsis easy to ...
0
votes
1answer
29 views

How can I POST or GET to the same admin page from which I am POST-ing or GET-ing

I have made a admin page linked to a Settings -> submenu_item. This page looks like this: http://movahon.dev/wp-admin/options-general.php?page=miama-google-recaptcha%2Fmiama-google-recaptcha.php On ...
0
votes
1answer
112 views

Options site set empty fields after submitting

add_action( 'admin_menu', 'fhwtest_plugin_menu' ); function fhwtest_plugin_menu() { add_menu_page( 'Reservierungs-Einstellungen', 'Reservierung', 'administrator', 'fhwtest_reservoptions', '...
0
votes
2answers
2k views

The entire wordpress theme reset to default after uploaded to live

I created a Wordpress website. Spent a couple of weeks to customized its CSS, PHP, Posts, uploading images, etc to be the how I wanted. BUT when I uploaded it to the server, all of my settings I have ...
0
votes
1answer
744 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....
4
votes
1answer
1k views

How to update an 'array' option using wp-cli [duplicate]

I'm trying to write a bash script to automate the syncing of a live site to a dev site. I have the basics figured out, like exporting the production db and importing / updating urls in the dev site, ...
0
votes
1answer
331 views

Create a counter variable in wp_options that increments when submit button is pressed

I'm a php beginner. I have an order form on my site (NB: the form is generated from a custom products plugin). I want to create a reference code whenever a user submits, now I need help with creating ...
10
votes
1answer
7k views

Please explain how Wordpress works with MySQL character set and collation at a low level

As the question title suggests, I'm looking to understand how Wordpress works with MySQL character sets and collation options. As I will show below, things don't make much sense to me... I installed ...
1
vote
0answers
433 views

wp_options siteurl and home hardcoded?

We received a WordPress site from the marketing team of our company and we successfully managed to get it up and running on a staging server but, we have now moved it to production and realized that ...
2
votes
1answer
592 views

What is the correct form action URL for network options pages?

Referring to Settings API in Multisite - Missing update message It states that: For network option pages the correct form action URL is: wp-admin/network/edit.php?action=your_option_name ...
0
votes
1answer
323 views

How to set a default theme option after installing theme?

I'm using a class to add a theme option page to my theme. I need to set some default values upon theme activation or installation, since some of these values are strings, and if i try to get the ...
1
vote
0answers
71 views

What is the correct way of updating wordpress options

I've added some codes to my theme's function so when I activated the theme, it will update the category base, permalinks, and post_per_page, and they worked perfectly fine. However, since I'm just ...
0
votes
2answers
5k views

My options table is huge. What can I do?

My options table is 3.2 GB! I ran a query to delete transients (only 172 were there), and I repaired and optimized the table, but it barely made a change. How can I go about finding out what's making ...
1
vote
1answer
765 views

My WP_options db rewrite_rules Does Not Work

On my site, I have my own custom php file that handles URL GET requests. For example, at mysite.com/?burger=WellDone, it will query my db and display a page with all burgers with "WellDone" in the ...
0
votes
0answers
2k 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 ...
1
vote
0answers
66 views

i changed my wordpress address url in SETTINGS - GENRERAL - wordpress address site url. cannot login anymore

i changed my wordpress address url in SETTINGS - GENRERAL - wordpress address site url. cannot login anymore. I have tried all sorts of tutorials to get to login to my admin page with no success. ...

1 2 3 4 5 20