Multiple entries in get_option results? or why is _multiwidget set to 1?

I found the answer. Multiwidget is a nice new feature within wordpress’ new widget API. Yet there is sparse documentation on how to use it. $options = get_option( ‘your_option_id’ ); if( isset($options) && isset($options[$this->number])) { //$this->number returns the unique widget id that corresponds to the database index $instance_options = $options[$this->number]; } //now use $instance_options[‘setting’]

Possible to add another setting to ‘Front page displays’ setting for Custom Post Type

It appears that the options-reading.php file is hard-coding its options, rather than using the Settings API. And that option is using wp_dropdown_pages() specifically. The Codex lists the following arguments for wp_dropdown_pages(): <?php $args = array( ‘depth’ => 0, ‘child_of’ => 0, ‘selected’ => 0, ‘echo’ => 1, ‘name’ => ‘page_id’); ?> The Codex page also … Read more

How do I update a nested option?

wp option does all you need. See wp option patch in particular. Updates a nested value in an option. Get a nested option value: $ wp option pluck ez-toc-settings auto_insert_post_types Set a nested option value (with an array): $ wp option patch update ez-toc-settings auto_insert_post_types ‘{“post”:”post”}’ –format=json

Best possible way to get all options

I think it is always better to use the API, the functions of WP in this context. The function wp_load_alloptions() is under maintain and a custom select must always tested and maintain. Also the function use the Cache, if the installation support this. A good point for performance. The function supports also the Multisite installation, … Read more

Settings API – how to update multiple options manually?

Fetch current options, and be sure to return an array if empty: $current_options = get_option( ‘option_name’, array() ); Ensure desired options are in an array: $desired_options = array( /* whatever you need goes here */ ); Merge them, using [wp_parse_args()]1: $merged_options = wp_parse_args( $current_options, $desired_options ); Update update_option( ‘option_name’, $merged_options ); Of course, the trick … Read more

How to default all users to no link for attachments?

This is the final non-JS method that finally worked for me: Step 1: update sitewide option You can do this several ways. Since setting it is a one-time operation, I opted to update this by visiting https://www.example.com/wp-admin/options.php . I searched for “image_default_link_type” and set it to “none” (the word none, not null), then saved the … Read more

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