Using widget options ‘outside’ the widget

@JonathonByrd’s answer is probably ‘best’ – certainly you should using get_option if at all possible, since there’s no guarantee the option name will stay the same between WordPress versions. Similarly – @JonathonByrd also relies on using a global variable which may be removed/renamed (though perhaps very unlikely). Unfortunately there are no public wrappers which we … Read more

What’s the difference between Options & Settings?

The Options API is primarily a database API, allowing you to get and store values in the options table of the database easily. The Settings API is an interface API. It allows you to build settings screens in a manner that will adapt with future changes to the WordPress interface, as well as to handle … Read more

Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?

The best place to flush rewrite rules is on plugin activation/deactivation. function myplugin_activate() { // register taxonomies/post types here flush_rewrite_rules(); } register_activation_hook( __FILE__, ‘myplugin_activate’ ); function myplugin_deactivate() { flush_rewrite_rules(); } register_deactivation_hook( __FILE__, ‘myplugin_deactivate’ ); See the codex article Apologies in advance, I didn’t make it all the way through your question, so this is a … Read more

Performance with autoload and the options table

I didn’t find much information about how the autoloaded values are used. There is no special case for autoloaded options, they are used in the same way as else regular options, but lets figure out what autoload column of the options table means. This column determines do we need to fetch an option at the … Read more

Contact form 7 select box different value-text than content-text in option [closed]

It looks like this is supported by Contact Form 7 natively, it’s just not very obvious on how to make it happen. Here’s a documentation page explaining the functionality: http://contactform7.com/selectable-recipient-with-pipes/ Basically, all you have to do is put the values like so: “Visible Value|actual-form-value” What comes before the pipe | character will be shown in … Read more

Update Option Stored in Multi-Dimensional Array

As far WordPress is concerned – your multi-dimensional array is one option. To update just part of the multi-dimensional array its necessary to retrieve the entire array, alter it accordingly and then update the entire array. Suppose your multi-dimensional array is as follows: my_options = array( ‘option_a’=>’value_a’, ‘option_b’=>’value_b’, ‘inner_array’=>array( ‘foo’ => ‘bar’, ‘hello’ => ‘world’, … Read more

How to add field for new site-wide option on Network Settings screen?

There’s a wpmu_options action that lets you append more HTML on the Network Settings page. If you want to add your own sub-menu/page to the Settings parent menu: add_action(‘network_admin_menu’, ‘add_my_netw_settings_page’); function add_my_netw_settings_page() { add_submenu_page( ‘settings.php’, ‘Co za asy’, ‘Co za asy’, ‘manage_network_options’, ‘my-netw-settings’, ‘your_form’ ); } function your_form(){ $options = get_site_option(‘your_plugin’); ?> <form action=”<?php echo … Read more

How to pass variable to add_settings_section() callback?

if you look at the do_settings_sections function more specifically the line 1164 where the callback function is being executed : call_user_func($section[‘callback’], $section); you can see that the $section array is being passed to the callback function, so you can identify the callback by the $section[‘id’] hope this make since. Update here is an example, if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)