array( 'type' => 'integer', 'minimum' => 1 ), ); } protected function output_properties(): array { return array( 'post_id' => array( 'type' => 'integer' ), 'deleted' => array( 'type' => 'integer' ), ); } /** * 'confirm' is intentionally absent — see Base_Rank_Math_Ability::ability(). */ protected function required_input(): array { return array( 'post_id' ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => true ); } /** * @param array $input * @return array|WP_Error */ protected function run( array $input ) { $result = Post_Meta_Repository::delete_schemas( isset( $input['post_id'] ) ? absint( $input['post_id'] ) : 0 ); if ( is_wp_error( $result ) ) { return $result; } $result['message'] = 0 === $result['deleted'] ? sprintf( /* translators: %d: post id */ __( 'Post %d had no schema to remove.', 'acrossai-abilities-manager' ), $result['post_id'] ) : sprintf( /* translators: 1: number of schemas removed, 2: post id */ _n( 'Removed %1$d schema from post %2$d.', 'Removed %1$d schemas from post %2$d.', $result['deleted'], 'acrossai-abilities-manager' ), $result['deleted'], $result['post_id'] ); return $result; } }