Skip to content

Instantly share code, notes, and snippets.

@DrewAPicture
Last active December 10, 2015 20:48
Show Gist options
  • Save DrewAPicture/4490539 to your computer and use it in GitHub Desktop.
Save DrewAPicture/4490539 to your computer and use it in GitHub Desktop.
Get a user's user settings and parse them into an array. Dumps into the admin footer in the Dashboard.
<?php
function get_a_users_settings() {
// Change 1 to the user's ID
// Or do $user = wp_get_current_user() and change $user_id in get_user_option to $user->ID
$user_id = 1;
$option = get_user_option( 'user-settings', $user_id );
if ( $option && is_string( $option ) ) {
parse_str( $option, $array );
echo '<pre>';
var_dump( $array );
echo '</pre>';
}
}
add_action( 'admin_footer', 'get_a_users_settings' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment