WordPress.org

Make WordPress Core

Ticket #20026: wp.getComments.patch

File wp.getComments.patch, 1.5 KB (added by nprasath002, 3 years ago)

post_type filter

  • class-wp-xmlrpc-server.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: C:\xampp\htdocs\wordtrunk\wp-includes
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    17371737                if ( isset($struct['post_id']) ) 
    17381738                        $post_id = absint($struct['post_id']); 
    17391739 
     1740                $post_type = ''; 
     1741                if ( isset($struct['post_type']) ) { 
     1742                        $post_type_object = get_post_type_object( $struct['post_type'] ); 
     1743                        if ( ! ( (bool) $post_type_object ) ) 
     1744                                return new IXR_Error( 403, __( 'Invalid post type' ) ); 
     1745                        $post_type = $struct['post_type']; 
     1746                } 
     1747 
    17401748                $offset = 0; 
    17411749                if ( isset($struct['offset']) ) 
    17421750                        $offset = absint($struct['offset']); 
     
    17451753                if ( isset($struct['number']) ) 
    17461754                        $number = absint($struct['number']); 
    17471755 
    1748                 $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) ); 
     1756                $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number, 'post_type' => $post_type ) ); 
    17491757                $num_comments = count($comments); 
    17501758 
    17511759                if ( ! $num_comments )