Home › Forums › General Issues › Creating A Custom User Options Page? › Reply To: Creating A Custom User Options Page?
This has not been tested, but I think id should work. I’m not sure of all the setting here, but the following will only create an options page if the user is logged in and will save the values to the _usermeta table. Basically, it creates a single options page that uses a different post ID value depending on what user is logging in so the values are saved and retrieved from the current user. Other ACF functions should work as long as you provide the correct id when using them https://www.advancedcustomfields.com/resources/how-to-get-values-from-a-user/
add_action('init', 'custom_user_options_page');
function custom_user_options_page() {
if (!is_user_loged_in()) {
return;
}
$user_id = get_current_user_id();
$post_id = 'user_'.$user_id;
$args = array(
'page_title' => 'User Options Page',
'post_id' => $post_id,
);
acf_add_options_page($args);
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.