Advanced Custom Fields is the most popular custom fields plugin. It adds a slick interface to the backend which enables you to add different meta box types for custom field data entry. Then you can use code in your theme to output or return the value for your custom fields.
The only problem is, the code ACF provides only works when the ACF plugin is active.
If the plugin is deactivated or you decide you no longer want to use it, the code ACF provides to use in your theme will no longer work and possibly cause fatal or non fatal errors.
How To Fix This
To fix any potential problems, you can use non ACF functions to output or return your custom fields data.
You can use either
get_post_meta which is built into WordPress or a theme specific function like
Firstly, let’s look at the ACF function the_field which enables you to output an image when using the return value of Image URL in the ACF field settings shown in this image:
And here’s the code you can add to your child themes functions file to display the image in any hook position:
the_field in the above function with
genesis_get_custom_field will not work.
Note: All code in this tutorial assumes the name of your custom field is image.
Here’s the code for logged in members which works with
get_post_meta or any theme specific wrapper function for custom field data output.
You need to pay to fully access this tutorial.
Enjoy unlimited access & coding support by registering.