Options table – where does my values go?

There is indeed an options table (wp_options / prefix_options). You can the find full details on that table here: http://codex.wordpress.org/Database_Description#Table:_wp_options Options are meant to be globally accessible (not tied to individual posts), and you only need to know the option name/key. You can access that table and its values with the following functions: <?php $your_option … Read more

Can’t switch theme after activation

It seems that you are executing updateTheme() in every page load. To execute tasks only on activation you should hooke the updateTheme() function to the register_activation_hook action hook: register_activation_hook( __FILE__, ‘activation_callback’ ); function activation_callback() { //The code inside this function is executed only on plugin activation $theme=”twentyeleven”; //SET the value of $theme to whatever you … Read more

My code for creating an admin option doesn’t work

Make Sure Your Functions, Slug and Callback Functions are Unique(Means Different from any other plugin or default WordPress). Also to save options use Settings API http://codex.wordpress.org/Function_Reference/register_setting <?php add_action(‘admin_menu’, ‘add_unique_custom_options’); function add_unique_custom_options() { add_options_page(‘Global Custom Options’, ‘Global Custom Options’, ‘manage_options’, ‘unique-functions’,’unique_custom_options’); } function unique_custom_options() { ?> <div class=”wrap”> <h2>Global Custom Options</h2> <form method=”post” action=”options.php”> <?php wp_nonce_field(‘update-options’) … Read more

Help with SQL query, how to add taxonomie terms with value stored in options?

ok folks, i did it anothere way.. here’s how i did it: add_filter( ‘pre_get_posts’, function( $query ) { if( ! is_main_query() || ! is_post_type_archive() || ! $query->get( ‘section’, false ) ) return $query; global $wpdb; $section = $query->get( ‘section’ ); unset( $query->query[‘section’] ); unset( $query->query_vars[‘section’] ); $query->tax_query = false; $query->set( ‘tax_query’, false ); $cateroties = … Read more

Create Array from data in the OPTIONS table

$all_options = wp_load_alloptions(); $plugin_order_options = array(); foreach( $all_options as $name => $value ) { if(stristr($name, ‘plugin_order_’)) $plugin_order_options[$name] = $value; } print_r($plugin_order_options); In plain English: We load all WP options in $all_options. We copy options from $all_options to $plugin_order_options if their name contains plugin_order_. We print $plugin_order_options. We scratch our head, unhappy with the size of … Read more

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