Support

Account

Home Forums General Issues ACF form post object field not loading

Solving

ACF form post object field not loading

  • Hi,

    I have a ACF form with 2 post object fields the posts in the posts object fields are loading for me as admin and for somewone that not loggedin. But if somebody is loggedin then the post object fields are giving the message: ‘The results could not be loaded.’

    Why is this happening for loggedin people but for admins and logout people they are loading?

    $upload_args = array(
    	'id' 			=> 'upload',
    	'post_id'		=> 'new_post',
    	'post_title'	=> false,
    	'post_content'	=> false,
    	'uploader' 		=> 'basic',
    	'new_post'		=> array(
    		'post_type'		=> 'uploads',
    		'post_status'	=> 'publish'
    	),
    	'submit_value'	=> 'Upload now'
    );
    
    acf_form( $upload_args );
  • It had something to do with hiding the dashboard function for loggedin users.

    function disable_dashboard() {
        if (!is_user_logged_in()) {
            return null;
        }
        if (!current_user_can('administrator') && is_admin()) {
    		$link = get_author_posts_url( get_current_user_id() );
    		
            wp_redirect($link);
            exit;
        }
    }
    add_action('admin_init', 'disable_dashboard');

    i remvoed this now and its working 🙂

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

You must be logged in to reply to this topic.