acf_get_fields | get_fields | get_filed | Advanced Custom Fields | function

Home – Download Forums Custom Fields acf_get_fields | get_fields | get_filed | Advanced Custom Fields | function

Viewing 0 reply threads
  • Author
    • #638

      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:-

      acf_get_fields | get_fields



      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 );



      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:{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.


      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 


      Feel free to PM or chat. We are ready to help you 🙂


Viewing 0 reply threads
  • You must be logged in to reply to this topic.