Opened 5 years ago
Last modified 4 years ago
#45030 reopened enhancement
Remove new_postarr from doc in wp_insert_post function
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
$new_postarr is not used but it is mentioned in the documentation of the wp_insert_post() function.
Attachments (3)
Change History (9)
#1
@
5 years ago
- Keywords reporter-feedback added
Thanks for the patch @mukesh27. $new_postarr
is the name given to the third of four parameters passed to this filter. Am I missing something?
#2
follow-up:
↓ 3
@
5 years ago
- Keywords reporter-feedback removed
Thank you for your reply @johnbillion. You can check online link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/post.php#L3575 filter wp_insert_post_parent
contain one array variable $postarr
.
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
5 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Replying to mukesh27:
You can check online link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/post.php#L3575 filter
wp_insert_post_parent
contain one array variable$postarr
.
The documentation for filters can be a little confusing.
The parameter names are for the function that the filter calls, rather than as passed. In this case compact( array_keys( $postarr ) )
is expected to be named $new_postarr
in the called function.
The code you link to is a shorter way of writing:
<?php $new_postarr = compact( array_keys( $postarr ) ); $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );
I'm going to close this ticket as invalid, which is trac's unfriendly way of documenting no change is needed.
#4
in reply to:
↑ 3
@
5 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
- Type changed from defect (bug) to enhancement
@peterwilsoncc my question is that we have to add code relate $new_postarr = compact( array_keys( $postarr ) );
and pass it to filter then doc elements are right as per written.
Need to add update code file like you suggested.
<?php $new_postarr = compact( array_keys( $postarr ) ); $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );
Replying to peterwilsoncc:
Replying to mukesh27:
You can check online link https://core.trac.wordpress.org/browser/trunk/src/wp-includes/post.php#L3575 filter
wp_insert_post_parent
contain one array variable$postarr
.
The documentation for filters can be a little confusing.
The parameter names are for the function that the filter calls, rather than as passed. In this case
compact( array_keys( $postarr ) )
is expected to be named$new_postarr
in the called function.
The code you link to is a shorter way of writing:
<?php $new_postarr = compact( array_keys( $postarr ) ); $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );I'm going to close this ticket as invalid, which is trac's unfriendly way of documenting no change is needed.
updated patch with file path