Title: Candidate::__clone
Published: May 20, 2026
Last modified: August 20, 2026

---

# Candidate::__clone()

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wordpress-aiclient-results-dto-candidate/__clone/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-results-dto-candidate/__clone/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-results-dto-candidate/__clone/?output_format=md#changelog)

Performs a deep clone of the candidate.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wordpress-aiclient-results-dto-candidate/__clone/?output_format=md#description)󠁿

This method ensures that the message object is cloned to prevent modifications to
the cloned candidate from affecting the original.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-results-dto-candidate/__clone/?output_format=md#source)󠁿

    ```php
    public function __clone()
    {
        $this->message = clone $this->message;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/php-ai-client/src/results/dto/candidate.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/php-ai-client/src/Results/DTO/Candidate.php#L113)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/php-ai-client/src/Results/DTO/Candidate.php#L113-L116)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-results-dto-candidate/__clone/?output_format=md#changelog)󠁿

| Version | Description | 
| [0.4.2](https://developer.wordpress.org/reference/since/0.4.2/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwordpress-aiclient-results-dto-candidate%2F__clone%2F)
before being able to contribute a note or feedback.