admin管理员组

文章数量:1278859

I want to create a wordpress plugin which is be able to load the values of the parent pages ACF Fields into the Values of the subpages. Is there a way to do that? At the moment I have the code to get the parent page ID and to check, if the ACF Checkbox is active:

 <?php


      function em_get_parent_page_id()
{
 $post = get_post();
$post_id = $post->ID ?? null;;
$parent_post_id = $post->post_parent ?? null;
return $parent_post_id > 0 ? $parent_post_id : $post_id;
}


 function em_is_parent_menu_enabled($post_id)
{
$is_active = get_field('parent_aktiv', $post_id)[0] ?? null;
return $is_active === 'active' ? true : false;
}

本文标签: phpCreate ACF Checkbox to get all ACF Values from Parent Page