//Get top ancestor
function get_top_ancestor_id()
{
global $post;
if($post->post_parent)
{
$ancestors = array_reverse(get_post_ancestors($post->ID));
return $ancestors[0];
}
return $post->ID;
}
Wordpress get_top_ancestor_id()
最新推荐文章于 2023-07-22 21:14:02 发布