[wp-trac] [WordPress Trac] #45030: Remove new_postarr from doc in wp_insert_post function

WordPress Trac noreply at wordpress.org
Wed Oct 3 22:08:57 UTC 2018


#45030: Remove new_postarr from doc in wp_insert_post function
-------------------------------+----------------------
 Reporter:  mukesh27           |       Owner:  (none)
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:  invalid
 Keywords:  has-patch          |     Focuses:  docs
-------------------------------+----------------------
Changes (by peterwilsoncc):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Replying to [comment:2 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
 <?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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45030#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list