Home Forums Backend Issues (wp-admin) Submenu page with user form


Submenu page with user form

  • I have additional fields I want to attach to users, but I don’t want to add the field group to the existing user profile page — I want to display it on a standalone back end page for each user to edit about themself. Is there a way I can cause the field group to be displayed and saved back to the user’s medadata? Maybe in the callback from add_users_page?

            __( 'Artist Profile', 'agec' ),
            __( 'Artist Profile', 'agec' ),
            //'agec_artistProfile_callback' <= magic happens here??
  • I do not know if this will work, it is just an untested theory.

    You can add a sub page to the user menu using an ACF options page. When setting up the options page set the “post_id” argument to something like “extra_user_options”.

    Create an acf/pre_load_post_id filter. This is an undocumented hook. It allows you to short-circuit ACF determination of the post ID. Here is the code in ACF

    function acf_get_valid_post_id( $post_id = 0 ) {
      // allow filter to short-circuit load_value logic
      $preload = apply_filters( 'acf/pre_load_post_id', null, $post_id );
      if ( $preload !== null ) {
        return $preload;

    If you return anything in the filter other than NULL then ACF will use that value for the post ID.

    In your filter check for the post ID you set up for the options page (i.e. “extra_user_options”) and if that is the post ID the return the correct post ID to cause ACF to use the user instead by returning "user_{$current_user_id}"

    If my theory is correct then ACF should load and save values to usermeta for the current user.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.