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

WordPress Trac noreply at wordpress.org
Thu Oct 4 04:36:23 UTC 2018


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

 * status:  closed => reopened
 * type:  defect (bug) => enhancement
 * resolution:  invalid =>


Comment:

 @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
 <?php
 $new_postarr = compact( array_keys( $postarr ) );
 $post_parent = apply_filters( 'wp_insert_post_parent', $post_parent,
 $post_ID, $new_postarr, $postarr );
 }}}

 Replying to [comment:3 peterwilsoncc]:
 > 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:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list