How to set “Site Address (URL)” programmatically on WP multisite?

If you just want to update that one value, then you can use wp_update_site(): wp_update_site( 123, [ ‘domain’ => ‘new-slug.domain.com’, ] ); But to really update the site URL/address, you’d need to update both the siteurl and home options for the site: switch_to_blog( 123 ); update_option( ‘siteurl’, ‘new URL here’ ); update_option( ‘home’, ‘new URL … Read more

Settings API – sanitize_callback is not called and it leads to an incorrect behavior

If I take the value sanitize_callback out of the argument array completely, everything works as desired, so error-free. Yes, and that’s because you used the wrong callable syntax which then causes PHP to use a global function named sanitize_options instead of the method/function of the same name in your class (i.e. Faqdesk_Settings::sanitize_options()). So to solve … Read more

Add a series of checkboxes to theme options

Want some honest advice? Work from a better code base.. Though, it’s not your fault, there are hundreds of blogs with variations of similar code, i’m not sure where it originated, but i see similar code “alot”… If you can get by without the hand holding and just manage with a good code base, i’d … Read more

Theme settings keep getting reset/erased

Try changing this line: if(isset($_POST[‘field_id’]) && !empty($_POST[‘field_id’])) to: if(isset($_POST[‘field_id’]) && !empty($_POST[‘field_id’]) && current_user_can(‘update_core’)) and: function pp_add_admin() { to: function pp_add_admin() { if(!current_user_can(‘update_core’)) return; and ask for a refund 🙂

Insufficient permissions to save options

I am not sure this is the issue here, but if I remember right the current limitation of Settings API is that manage_options capability is required for everything to be saved properly. Quick search shows it might get fixed in 3.2, see this trac ticket.

shortcode causing the_content() to return blank?

Fixed my problem! I was finally able to find some info out there in the vast internet. Visit this site for info on fixing this odd issue. Over all using the remove_filter(‘the_content’,’wpautop’); did the trick. http://www.undermyhat.org/blog/2009/07/sudden-empty-blank-page-for-large-posts-with-wordpress/

Bulk theme settings in wordpress multisite

If you configure your Theme settings code properly, the Theme will work fine without having any user-defined settings. The key is to define a defaults array, and anytime you need to output a Theme option, run an array_merge() on the defaults array, and the theme’s options DB entry. Something like this: <?php global $mytheme_options; $mytheme_options … Read more

Default Plugin Settings Not Writing to Database

I believe the issue is that your function that sets up the settings initially isn’t getting run upon activation. Add a call to your mouldings_register_settings_initial() in the activation hook, like this: function mouldings_activate() { global $wpdb, $mouldings_options; mouldings_register_settings_initial(); if ($mouldings_options === false){ $mouldings_options = array( ‘idea_item_columns’ => ‘4’ ); update_option( ‘mouldings_settings’, $mouldings_options ); } } … Read more

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