I have a question on this topic. I have three post types. Notebooks -> Notebook Sections -> Notebook Pages. I have added two post object fields to the notebook pages. The first one picks the notebook the page goes into and I want the second one to only pull up the notebook sections that are children of the notebook selected. I also have a post object field on the notebook sections to choose the notebook parent to attach it to. This is the code I am using in my functions.php for that one.
function my_acf_save_post( $post_id ) {
// Get the selected post status
$value = get_field('notebook_section_post_parent', $post_id);
// Update current post
$post = array(
'ID' => $post_id,
'post_parent' => $value,
);
// Remove the action to avoid infinite loop
remove_action('acf/save_post', 'my_acf_save_post', 20);
// Update the post into the database
wp_update_post( $post );
// Add the action back
add_action('acf/save_post', 'my_acf_save_post', 20);
}
// run after ACF saves the $_POST['acf'] data
add_action('acf/save_post', 'my_acf_save_post', 20);
So, how do I make the notebook section field on the notebook pages only pull up the children of the notebook selected? I’m really new to coding, so I just can’t wrap my head around it and how to do it without it all getting so complicated. I appreciate ANY advice. Thanks!