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