Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_get_post_parent_id ›

Desde3.1.0
Obsoleton/a
wp_get_post_parent_id ( $post )
Parâmetros:
  • (int|WP_Post) $post Post ID or post object. Defaults to global $post.
    Required: Yes
Retorna:
  • (int|false) Post parent ID (which can be 0 if there is no parent), or false if the post does not exist.
Definido em:
Codex:

Returns the ID of the post's parent.



Fonte

function wp_get_post_parent_id( $post ) {
	$post = get_post( $post );
	if ( ! $post || is_wp_error( $post ) ) {
		return false;
	}
	return (int) $post->post_parent;
}