How to create callback function which returns all posts with specific data?
Found! This function returns the specified fields for each post. function get_all ( $params ){ $posts = get_posts( array( ‘offset’ => 0, ‘post_status’ => ‘publish’ ) ); if ( empty( $posts ) ) { return null; } $posts_data = array(); foreach( $posts as $post ) { $posts_data[] = (object) array( ‘id’ => $post->ID, ‘date’ => … Read more