Load Featured Image into form

[ad_1]

I’m glad to hear it now works as expected.

The {form:xxxxx} template tag allows you to retrieve any form setting (see documentation). That’s why you need to pass custom data if you want to retrieve it.

For example:

acfe_form(array(
'name' => 'my_form', // {form:name},
'photo_id' => 45, // {form:photo_id}
'post_id' => 122, // {form:post_id}
'submit' => array(
'value' => 'Submit', // {form:submit:value}
),
))

Note that you can use the template tag {request:photo_id} (see documentation), to directly retrieve the URL parameter, without any PHP code instead.

However this is considered unsafe, as the visitor might enter/change the ID in the URL, and being able to save/load any post/page on the front-end. Which is indeed problematic.

This is why I suggested the PHP method with {form:xxxxx}, as it allows you to check the current user is authorized to save/load the ID retrieved from the URL.

Furthermore, I strongly suggest you to add some safety measures in PHP to make sure the visitor is allowed to use that ID from the URL.

Regarding the checkbox in the Save/Load tabs, these settings simply tell the form which fields should have their value saved/loaded from the target/source. It does not control if it should be displayed or not. Thus the setting instruction:

Load ACF fields

Select which ACF fields should have their values loaded

If you want to only display some specific fields, or change the fields order, you can use the “Render” tab in the Form UI. There, you can enter any HTML (if needed), and any field you want to display using the {render:my_field} template tag. Example:

{render:my_field_1}
{render:my_field_2}
{render:my_field_3}

If you prefer using the PHP code/hook, then it will also work and override the “Render” set in the Form UI.

If you don’t want to enter each fields manually in the “Render” tab, you can also let the form display all fields automatically, and hide only few of them. Here is a guide explaining the different methods to hide fields on the front-end.

Regarding the question about the 9/10 before/after priority in hooks, I’m not sure to understand what you’re talking about. Can you please point which part of the documentation/hook you’re talking about?

Thanks.

Regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer