Tex. Code of Criminal Procedure § 26.13 — TX Code / Code cr / Chapter 26 / Section 26.13
§ 26.13. PLEA OF GUILTY.
Status: in_force

(a) Prior to accepting a plea of guilty or a plea of nolo contendere, the court shall admonish the defendant of:

(1) the range of the punishment attached to the offense;

(2) the fact that the recommendation of the prosecuting attorney as to punishment is not binding on the court. Provided that the court shall inquire as to the existence of a plea bargain agreement between the state and the defendant and, if an agreement exists, the court shall inform the defendant whether it will follow or reject the agreement in open court and before any finding on the plea. Should the court reject the agreement, the defendant shall be permitted to withdraw the defendant's plea of guilty or nolo contendere;

(3) the fact that if the punishment assessed does not exceed the punishment recommended by the prosecutor and agreed to by the defendant and the defendant's attorney, the trial court must give its permission to the defendant before the defendant may prosecute an appeal on any matter in the case except for those matters raised by written motions filed prior to trial;

(4) the fact that if the defendant is not a citizen of the United States of America, a plea of guilty or nolo contendere for the offense charged may result in deportation, the exclusion from admission to this country, or the denial of naturalization under federal law;

(5) the fact that the defendant will be required to meet the registration requirements of Chapter 62, if the defendant is convicted of or placed on deferred adjudication for an offense for which a person is subject to registration under that chapter; and

(6) the fact that if the defendant is placed on community supervision, after satisfactorily fulfilling the conditions of community supervision and on expiration of the period of community supervision, the court is authorized to release the defendant from the penalties and disabilities resulting from the offense as provided by Article 42A.701(f).

(b) No plea of guilty or plea of nolo contendere shall be accepted by the court unless it appears that the defendant is mentally competent and the plea is free and voluntary.

(c) In admonishing the defendant as herein provided, substantial compliance by the court is sufficient, unless the defendant affirmatively shows that he was not aware of the consequences of his plea and that he was misled or harmed by the admonishment of the court.

(d) Except as provided by Subsection (d-1), the court may make the admonitions required by this article either orally or in writing. If the court makes the admonitions in writing, it must receive a statement signed by the defendant and the defendant's attorney that the defendant understands the admonitions and is aware of the consequences of the plea. If the defendant is unable or refuses to sign the statement, the court shall make the admonitions orally.

(d-1) The court shall make the admonition required by Subsection (a)(4) both orally and in writing. Unless the court has received the statement as described by Subsection (d), the court must receive a statement signed by the defendant and the defendant's attorney that the defendant understands the admonition required by Subsection (a)(4) and is aware of the consequences of the plea. If the defendant is unable or refuses to sign the statement, the court shall make a record of that fact.

(e) Before accepting a plea of guilty or a plea of nolo contendere, the court shall, as applicable in the case:

(1) inquire as to whether a victim impact statement has been returned to the attorney representing the state and ask for a copy of the statement if one has been returned; and

(2) inquire as to whether the attorney representing the state has:

(A) given notice of the existence and terms of any plea bargain agreement to the victim, guardian of a victim, or close relative of a deceased victim, as those terms are defined by Article 56A.001; and

(B) conferred with the victim, guardian of a victim, or close relative of a deceased victim regarding the disposition of the case.

(f) The court must substantially comply with Subsection (e) of this article. The failure of the court to comply with Subsection (e) of this article is not grounds for the defendant to set aside the conviction, sentence, or plea.

(g) Before accepting a plea of guilty or a plea of nolo contendere and on the request of a victim of the offense, the court may assist the victim and the defendant in participating in a victim-offender mediation program.

(h) The court must substantially comply with Subsection (a)(5). The failure of the court to comply with Subsection (a)(5) is not a ground for the defendant to set aside the conviction, sentence, or plea.

(h-1) The court must substantially comply with Subsection (a)(6). The failure of the court to comply with Subsection (a)(6) is not a ground for the defendant to set aside the conviction, sentence, or plea.

(i) Notwithstanding this article, a court shall not order the state or any of its prosecuting attorneys to participate in mediation, dispute resolution, arbitration, or other similar procedures in relation to a criminal prosecution unless upon written consent of the state.