wp_insert_post_parent
Filter HookDescription
Filters the post parent -- used to check for and prevent hierarchy loops.Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4702 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$post_parent
|
Post parent ID. |
int
|
$post_id
|
Post ID. |
array
|
$new_postarr
|
Array of parsed post data. |
array
|
$postarr
|
Array of sanitized, but otherwise unmodified post data. |
Usage Examples
Basic Usage
<?php
// Hook into wp_insert_post_parent
add_filter('wp_insert_post_parent', 'my_custom_filter', 10, 4);
function my_custom_filter($post_parent, $post_id, $new_postarr, $postarr) {
// Your custom filtering logic here
return $post_parent;
}
Source Code Context
wp-includes/post.php:4702
- How this hook is used in WordPress core
<?php
4697 * @param int $post_parent Post parent ID.
4698 * @param int $post_id Post ID.
4699 * @param array $new_postarr Array of parsed post data.
4700 * @param array $postarr Array of sanitized, but otherwise unmodified post data.
4701 */
4702 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_id, $new_postarr, $postarr );
4703
4704 /*
4705 * If the post is being untrashed and it has a desired slug stored in post meta,
4706 * reassign it.
4707 */
PHP Documentation
<?php
/**
* Filters the post parent -- used to check for and prevent hierarchy loops.
*
* @since 3.1.0
*
* @param int $post_parent Post parent ID.
* @param int $post_id Post ID.
* @param array $new_postarr Array of parsed post data.
* @param array $postarr Array of sanitized, but otherwise unmodified post data.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.