Here is the official statute:
Transportation Code 545.414. Riding in Open Beds; Offense
(a) A person commits an offense if the person operates an open-bed pickup truck or an open flatbed truck or draws an open flatbed trailer when a child younger than 18 years of age is occupying the bed of the truck or trailer.
(b) An offense under this section is a misdemeanor punishable by a fine of not less than $25 or more than $200.
(c) It is a defense to prosecution under this section that the person was:
(1) operating or towing the vehicle in a parade or in an emergency;
(2) operating the vehicle to transport farmworkers from one field to another field on a farm-to-market road, ranch-to-market road, or county road outside a municipality;
(3) operating the vehicle on a beach;
(4) operating a vehicle that is the only vehicle owned or operated by members of the household;
(5) or operating the vehicle in a hayride permitted by the governing body of or law enforcement agency of each county or municipality in which the hayride will occur.
(a) Compliance or noncompliance with Subsection (a) is not admissible evidence in a civil trial.
(b) In this section, "household" has the meaning assigned by Section 71.005, Family Code.
It is legal in TX as long as the bed is covered. Never carry anyone in the bed of a truck unless they are properly restrained