function was_unfinished($id) { $Workroom = get_post_id_by_meta_value($id); $Parent = has_parent($id); return $Parent || $Workroom ? true : false; }
function has_parent($id, $parent_name) { global $__has_parent_depth; $__has_parent_depth++; if ($__has_parent_depth == 100) { exit('too much recursion'); } $post = get_post($id); if ($post->post_name == $parent_name) { return true; } if ($post->post_parent == 0) { return false; } $__has_parent_depth--; return has_parent($post->post_parent, $parent_name); }