array( 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'description' => __( 'Post IDs to purge.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'post_ids', ); } protected function output_properties(): array { return array( 'purged' => array( 'type' => 'array' ), 'missing' => array( 'type' => 'array' ), ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => true, ); } protected function run( array $input ) { $ids = isset( $input['post_ids'] ) && is_array( $input['post_ids'] ) ? $input['post_ids'] : array(); $result = Purge_Repository::purge_posts( $ids ); if ( is_wp_error( $result ) ) { return $result; } return array( 'purged' => $result['purged'], 'missing' => $result['missing'], 'message' => sprintf( /* translators: 1: number purged, 2: number missing */ __( 'Purged %1$d post(s); %2$d id(s) did not exist.', 'acrossai-abilities-manager' ), count( $result['purged'] ), count( $result['missing'] ) ), ); } }