Skip to content

Commit

Permalink
use post type variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mehul0810 committed Jun 26, 2024
1 parent bdc9b85 commit 58471b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,11 @@ function check_post_types_permissions() {
* @return \WP_REST_Response|\WP_Error
*/
function get_pull_content_list( $request ) {
$args = [
$post_type = ! empty( $request['post_type'] ) ? $request['post_type'] : array( 'post', 'page' );
$args = [
'posts_per_page' => isset( $request['posts_per_page'] ) ? $request['posts_per_page'] : 20,
'paged' => isset( $request['page'] ) ? $request['page'] : 1,
'post_type' => array( 'post', 'page' ),
'post_type' => $post_type,
'post_status' => isset( $request['post_status'] ) ? $request['post_status'] : array( 'any' ),
'order' => ! empty( $request['order'] ) ? strtoupper( $request['order'] ) : 'DESC',
];
Expand Down

0 comments on commit 58471b8

Please sign in to comment.