Support

Account

Home Forums Front-end Issues acf_form is disabled for anonymous user

Helping

acf_form is disabled for anonymous user

  • Hi! All is good for loggin users, form is render and it’s OK, but I need create post for anonymous user and manually it’s impossible, its too much time to lost.

    In header:
    acf_form_head();

    Content:

    acf_form(array(
    'post_id'	=> 'new_post',
    'new_post'=> array(
    'post_type'	=> 'cvuser',
    'post_status'=> 'draft',
    'post_title'=>apply_filters('cv_title',0),
    'post_author' => wp_get_current_user()->data->ID,
    ),
    'submit_value'	=> 'Stwórz',
    ));

    Next I tried like this:
    //'post_author' => get_user_by('user_username','mkmm-root')//wp_get_current_user()->data->ID,

    —- Versions —-
    ACF v5.6.5
    WP v4.9.5

  • What do you mean with

    I need create post for anonymous user

    ?
    “wp_get_current_user” only returns a valid output while a user is logged in, so forget this.

    Do you want an form that creates posts with an “anonymous user” profile? Thats not possible. But you can create a User called anonymous and use this as post_author.

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

The topic ‘acf_form is disabled for anonymous user’ is closed to new replies.