Cannot get ACF from custom post type post

acf custom post type
acf custom post type loop
acf post object not working
acf post type selector
get post object acf
custom fields not showing in custom post type
acf get field by post id
acf post object query

I have a custom post type called "members", which has an ACF field connected. I try to get the content of that field. But when I try, I only get the regular post object. Not the ACF fields connected.

Here is what i am trying, but only getting the post object.

`

$featuredmembers = get_field('featured_member');
global $post;

//$featuredmembers has a field named "featured". That's the field I want.


$posts = get_posts([
  'post_type' => 'members',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'order' => 'ASC',
  'orderby' => 'title'
]);


foreach ($featuredmembers as $post) {
  print_r($post['featured']->ID);
  echo get_field('featured');
}

`

Try passing the post id in the get_field / the_field call within the foreach loop:

foreach ($featuredmembers as $post) {
    // the_field('featured', $post->ID);
    echo get_field('featured', $post->ID);
}

If it's a repeater field you can use:

foreach ($featuredmembers as $post) {
    the_repeater_field('featured', $post->ID);
}

ACF - Can't get custom post type by taxonomy, I'm using ACF and have a custom post type called "services". The CPT has a custom taxonomy called "category", this returns the TermID of the� Overview. All the template functions (get_field, the_field, etc) can be used to load values from another post, however, a second parameter is required to target the post.

I think this might be down the foreach loops using a variable of $post. This will override the main $post variable of the page, and any get_field function calls after the foreach loop will be looking at the wrong post.

Try renaming those variables to something other than $post

ACF Custom Fields not Showing in Custom Post Type, I am using your plugin in conjunction with Advanced Custom Fields. Support � Plugin: Custom Post Type UI � ACF Custom Fields not Showing in Custom Post Type If you do reach out to them, and they find it's something we need to change on If the latter, then CPTUI doesn't have any hand in that topic, as we do not� I have a custom post type called "members", which has an ACF field connected. I try to get the content of that field. But when I try, I only get the regular post object. Not the ACF fields connected. Here is what i am trying, but only getting the post object. `

Have you tried using WP_Query to get access to the post_id?

$args = array(
'post_type'   => 'members',
'post_status' => 'publish',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'title'
);

$query = new WP_Query( $args );

if( $query->have_posts() ) :
  while( $query->have_posts() ) :
    $current_post->the_post();
    $post_id = get_the_ID();
    $featured = esc_html(get_post_meta($post_id, 'featured_member', true));
endwhile;

wp_reset_postdata();

else :
    esc_html_e( 'no members found', 'text-domain' );
endif;

Post Object: Selection does not show up in Custom Post Type, Post Object: Selection does not show up in Custom Post Type I have an ACF field called “banner_selection” which displays all “banner” thus I don't see how come it doesn't work on single-company.php but only on single.php use second parameter to get the fields from this post echo $post_id� The post_id setting is used to edit an existing post, but when set to ‘new_post’, a new post will be created. The new_post setting is used to specify an array of elements that make up a post. These elements can be found in the wp_insert_post() documentation.

ACF, As results are grouped by their post type, the selected post types here may be positioned into a specific order. Filter by Taxonomy Filters the selectable results via� From the Custom Fields admin screen, click the Add New button to create a new field group. Add the fields you would like to see when editing a Post. Under Locations, select one of the Post related rule types (such as Post Type) and then select the corresponding value to show this field group.

How to Fix Custom Fields Not Showing in WordPress, To get there, log in to the WordPress Admin Area, then visit the Posts The same steps work on “Edit Post”, “Edit Page”, and “Edit Custom Post Type” screens. If you follow these steps and still can't find any Custom Fields meta, skip For some reason the plugin called Advanced Custom Fields (ACF)� Description. Returns the value of a specific field. Intuitive and powerful (much like ACF itself ?), this function can be used to load the value of any field from any location.

Custom Post Types | Discussion, I have set up my CTP (album) with CPT UI and Advanced Custom Fields. I cannot get a single post type displayed with or without single-album.php being� Download, install and activate Advanced Custom Fields. Advanced Custom Fields is a great plugin that gives you a graphical interface for building custom fields. You create sets of fields and then assign those sets to your custom post types, or really any number of criteria (but we’ll get to that a bit later).

Comments
  • Hi! I have actually tried that, since thats how i usually do it. But it wont work. I get nothing. Its a repeater field if that makes sense.
  • Have you tried the_repeater_field('featured', $post->ID); ?
  • Yes, same. No result.
  • Only thing that i get to work is to get the post. Like: $post['featured']. But i don not get its ACF fields.
  • Oh, where are you calling get_post? you might already be inside a wp_query. If so try call it after the query