| 390 | * Whether the post has a parent post. |
| 391 | * |
| 392 | * @since 4.3.0 |
| 393 | * |
| 394 | * @param int|WP_Post $id Optional. Post ID or post object. |
| 395 | * @return bool |
| 396 | */ |
| 397 | function has_parent( $id = 0 ) { |
| 398 | $post = get_post( $id ); |
| 399 | return ( $post->post_parent > 0 ); |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * Retrieve the parent post ID. |
| 404 | * |
| 405 | * @since 4.3.0 |
| 406 | * |
| 407 | * @param int|WP_Post $id Optional. Post ID or post object. |
| 408 | * @return int |
| 409 | */ |
| 410 | function get_parent( $id = 0 ) { |
| 411 | $post = get_post( $id ); |
| 412 | |
| 413 | /** |
| 414 | * Filter the retrieved post parent id. |
| 415 | * |
| 416 | * @since 4.3.0 |
| 417 | * |
| 418 | * @param string $post_parent The post parent id. |
| 419 | */ |
| 420 | return apply_filters( 'get_parent', $post->post_parent ); |
| 421 | } |
| 422 | |
| 423 | /** |