As defined by the WordPress codex use this to get the parent get_post_ancestors( $post )
, The direct parent is returned as the first value in the array.
Edit: get_post_ancestors( get_queried_object_id() )
can also work
As defined by the WordPress codex use this to get the parent get_post_ancestors( $post )
, The direct parent is returned as the first value in the array.
Edit: get_post_ancestors( get_queried_object_id() )
can also work