Support

Account

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);
    }