# Reactions::toggle()

Toggle a reaction on any registered object.

```php
toggle( string $object_type, int $object_id, int $user_id, string $slug )
```

## Parameters

- `$object_type` (string) Registered object type.
- `$object_id` (int) Object ID.
- `$user_id` (int) Reacting user.
- `$slug` (string) Reaction type slug.

## Return

`array<string, mixed>|WP_Error` New state (`object_type`, `object_id`, `active`, `reaction_type`, `reactions_count`, `reactions_by_type`, `user_reactions`) or a WP_Error with an HTTP status.

## Changelog

| Version | Description |
| --- | --- |
| 1.6.2 | Introduced |
