0

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;
}
2
  • Third party plugins and themes are off topic, they are better asked about at their developers' support routes.
    – vancoder
    Oct 19 at 15:09
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Oct 20 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.