WordPress options page not saving

You need to pay attention to $page parameter, if its not same anywhere it will not work. <?php add_settings_field( $id, $title, $callback, $page, $section, $args ); ?> $page (string) (required) The menu page on which to display this field. Should match $menu_slug from add_theme_page() or from do_settings_sections(). https://codex.wordpress.org/Function_Reference/add_settings_field <?php add_settings_section( $id, $title, $callback, $page ); … Read more

The Settings API – What is the purpose of default value in register_setting?

Excerpt from the register_setting() documentation: ‘default’ (mixed) Default value when calling get_option(). So the purpose of the default argument is to provide a default value which get_option() would return if the option does not exist (or has not yet been saved) in the database. And register_setting() sets the option’s default value via filter_default_option() which is … Read more

How to display usermeta on front end of site

<?php $user_id = 9; $key = ‘last_name’; $single = true; $user_last = get_user_meta( $user_id, $key, $single ); echo ‘<p>The ‘. $key . ‘ value for user id ‘ . $user_id . ‘ is: ‘ . $user_last . ‘</p>’; ?> More information here – http://codex.wordpress.org/Function_Reference/get_user_meta

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.

get_option array value defaults and best practices

First question: Is this a good practice? Based on the type of value you are saving, array as settings value is definitely good practice. How can I do this for a value within an array ex. get_option(‘header’)[‘header_logo’][‘image’]? If you believe option value for header might be empty or not saved, you can use this – … Read more

update a value in wp_options [closed]

This is escaped JSON. Formatted nicely, it looks like this: [ { “title”: “Brand Primary”, “value”: “#2185D0”, “_id”: “627a0637cf178d93e50be224cc07cd6e” }, { “title”: “Brand Secondary”, “value”: “transparent”, “_id”: “017280d9ec94a585c2de0bee8f49d8fb” }, { “title”: “Typo normal”, “value”: “#383838”, “_id”: “ff77119a11466c8d7a0efd612109fe6a” }, { “title”: “Typo on Brand Base”, “value”: “#383838”, “_id”: “8a3c1eebb8067b37fc47fc505f44b8b4” }, { “value”: “rgb(255, 255, 255)”, “title”: … Read more

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