I can’t upload image when using AFC plugin

To solve this bug:

If you are using the free version of AFC plugin: Accessing to your hosting -> Your WordPress content -> wp-content -> plugins -> advanced-custom-fields -> includes -> acf-form-functions.php -> Go to line 78 -> Replacing

		// Create hidden inputs from $data
		foreach( $data as $name => $value ) {
			acf_hidden_input(array(
				'id'	=> '_acf_' . $name,
				'name'	=> '_acf_' . $name,
				'value'	=> $value
			));
		}

with

		foreach( $data as $name => $value ) {
			if ($name == 'post_id') {
				$value = isset($_REQUEST['listing_id']) ? $_REQUEST['listing_id'] : "";
			}
			acf_hidden_input(array(
				'id'	=> '_acf_' . $name,
				'name'	=> '_acf_' . $name,
				'value'	=> $value
			));
		}

And go to advanced-custom-fields -> includes -> assets.php -> Replace

'post_id'		=> acf_get_form_data('post_id'),

with

'post_id'		=> isset($_REQUEST['listing_id']) ? $_REQUEST['listing_id'] : '',

If you are using Pro version: Accessing to your hosting -> Your WordPress content -> wp-content -> plugins -> advanced-custom-fields-pro -> includes -> Opening input.php -> go to line 242 -> Replacing the current code with

‘post_id’ => !is_admin() && isset($_REQUEST[‘listing_id’]) ? ”: acf_get_form_data(‘post_id’),

 

Leave A Comment?