I’m assuming you are using the standard foreach
type of loop structure, so the problem must lie in the query or the underlying data. Would you please post your code for setting up and instantiating the query? Also, how is the ACF value getting assigned to your custom posts? When you edit something, are you editing the post object or an ACF value? If ACF, how does that get assigned to the associated post.
Using posts to reflect ACF values sounds redundant. Why wouldn’t you use ACF values directly? You said these values are categories? Why not use taxonomy terms instead of ACF or custom posts? You are free to do what you like with your site of course, all I’m really saying is it sounds like there may be a better way. If you prefer to stay focused on the immediate problem, that’s fine.
I am essentially looping like this
query_posts(‘post_type=menu_item’);
if(have_posts()){
$i = 0;
echo ‘<ul class=”menu-bull”>’;
while ( have_posts()) : the_post();
id = $_POST[“id”];
if( get_field(‘menu’) == $id){
code here
}
endwhile;
}
wp_reset_query();
I used custom advanced custom field since I wanted a way to make a post become a menu item. Essentially id rather focus on why only one item is showing and its the last one I edited.
I suspect accidental interference by other code into your query. It’s worth trying to setup the query with get_posts() and setup_postdata(). It’s what we’re supposed to use instead of query_posts(). More importantly, it changes some underlying query vars which might be enough to prevent the interference.
If that does not help, try disabling all plugins except ACF. If still no help, isolate out the code needed for the custom post and menu listing and temporarily copy it into a default twenty* theme, then activate that theme. If still no help, the problem would be somewhere in your isolated code or ACF plugin. One of the prior actions probably stopped the problem. To determine which module caused the problem, reactivate each in turn until the problem recurs. The last activated will be the cause.