WPDebugLog

acf_get_fields | get_fields | get_filed | Advanced Custom Fields | function

Advanced Custom Fields (ACF) acf_get_fields function return field name, label and key etc get_fields() function return all data with field name. We can list all fields and value for post type also by get_fields( $post_id ). The acf_get_fields will return fields. This function not attached to posts.  

The acf_get_fields Function Example:-

    Above image output as bellow. We can copy group id from wp-admin > Edit field group > URL  post={id}
$fields = acf_get_fields( $field_group_id );
Output:- [crayon-674e00805f30f779348798/]   More custom filed functions.  

Example - get_fields() :-

$fields = get_fields( $post_id ); It will return saved post ACF fields name and the corresponding value.   API URL: http://example.com/wp-json/acf/fileds-by-post-id/{post-id}  Change {post-id} with your post id. It is a custom ACF API example code. Just copy-paste the below code to your functions.php then navigate the API URL. We can use this function for WooCommerce products or any other custom post type or page ACF data. We can make a request for API URL from the front end by jQuery ajax or fetch the javascript function.   [crayon-674e00805f31b945170342/] This will return the field name and value as an array. It will return false, if not exist ACF fields for the current post.

ACF get_field Function-

The ACF get_field function returns the value of the custom field. $value = get_field( 'field_name', $post_id ); More details  [embed]https://youtu.be/pG5EFSLnqG4[/embed] Feel free to PM or chat. We are ready to help you :)