Docs/Tutorials/Ship a Panel as Code
Ship a Panel as Code
Turn a panel you built visually into a plain PHP file you can commit to your theme or plugin — for when a database row isn't the right way to ship a release.
-
Open the panel
In the Option Builder, open the panel you want to ship.
-
Bake to PHP
Choose Bake to PHP in the top toolbar. The generated file uses
TPMeta_Options::set_args()/set_section()exactly as a hand-written panel would (see Developer Guide → Creating Field Groups), preserving switchdata_type, imagereturn_format, dimension slider bounds, post-select query config and repeater sub-fields. -
Commit it
Copy the generated code into your theme's
functions.phpor a dedicated options file, and commit it to version control. It has no dependency on the builder — it keeps working even if the builder is later deactivated.
Bake is for code you ship in a theme/plugin release — structure only, no saved values, safe to commit. Export/Import (see Move Data Between Sites) moves a live configuration, including saved values, between running sites as JSON.