About this plugin
The Pure Metafields Plugin is a powerful tool designed to enhance the functionality and flexibility of your WordPress website. With this plugin, you can easily create and manage custom meta boxes, adding extra fields and data to your posts, pages, and custom post types.
Key Features
✅ Custom Meta Boxes: Create unlimited custom meta boxes with ease. Define the title, placement, and priority of each meta box to suit your needs.
✅ Flexible Field Types: The plugin offers a wide range of field types to choose from, including text, textarea, select, checkbox, radio buttons, date picker, color picker, gradient, image, gallery, editor, and more.
✅ Repeatable Fields: Enable the ability to repeat fields, allowing users to add multiple instances of the same field dynamically. Perfect for scenarios where you need to capture multiple sets of data.
✅ Conditional Logic: Set up conditional logic to show or hide fields based on the value of other fields. This feature adds versatility and improves the user experience of your forms.
✅ Theme Options Panel: Register unlimited theme option panels with a clean admin UI. Values are stored as WordPress theme_mods and readable with the standard get_theme_mod() API.
✅ Visual Options Builder: Build and manage option panels from a drag-and-drop admin interface — no PHP required. Supports all field types and row/column layouts.
✅ Bake to PHP: Export any builder panel to a standalone PHP file for clean deployment in themes or plugins.
✅ WordPress Customizer Integration: Mirror any option panel into Appearance → Customize with one checkbox. All field types are supported with full sidebar UI.
✅ Save and Retrieve Meta Data: The plugin provides simple functions to save and retrieve meta data, allowing you to access and utilize the stored information in your themes or plugins.
✅ Integration with WordPress API: Seamlessly integrate with the WordPress API and extend its functionalities. Hook into actions and filters to manipulate meta data and create dynamic interactions.
Live Docs
Theme Options Panel
The Options Panel framework lets you register admin option pages that store values as WordPress theme_mod s. Read values anywhere with tpmeta_get_option() or the standard get_theme_mod().
Create an Options Panel
Register a panel and its sections inside an init action. Each section holds an array of fields.
php add_action( 'init', function () {
$opt_name = 'my_theme_options'; // unique panel ID
TPMeta_Options::set_args( $opt_name, array( 'menu_title' => 'Theme Options', 'page_title' => 'Theme Options', 'menu_slug' => 'my-theme-options', 'menu_icon' => 'dashicons-admin-appearance', 'menu_position' => 60, 'capability' => 'manage_options', 'output_css' => true, // auto-print CSS from fields that have 'output' 'customizer_integration' => false, // set true to mirror into Appearance → Customize ) );
TPMeta_Options::set_section( $opt_name, array( 'id' => 'general', 'title' => 'General', 'icon' => 'dashicons-admin-generic', 'fields' => array( // add field arrays here (see field types below) ), ) );
>
Options Panel — Text Field
>
Options Panel — Textarea Field
>
Options Panel — Colorpicker
>
Options Panel — Select Field
>
Options Panel — Switch Field
>
Options Panel — Checkbox Field
>
Options Panel — Tabs (Group Buttons)
>
Options Panel — Datepicker
>
Options Panel — Image Field
>
Options Panel — Gallery Field
>
Options Panel — Editor Field
>
Options Panel — Color Gradient
>
Options Panel — Multicolor
>
Options Panel — Post Select
>
Options Panel — Repeater Field
>
Options Panel — Conditional Logic
Show or hide a field based on the value of another field in the same section.
php // Field that controls visibility array( 'id' => 'enable_custom_footer', 'type' => 'switch', 'label' => 'Enable Custom Footer', 'default' => 'off', ),
>
Get Option Panel Value
php // Recommended helper (returns default if not set): $value = tpmeta_get_option( 'field_id', $default );
>
Get Repeater Rows from Options Panel
php $rows = tpmeta_get_repeater_rows( 'social_links' );
>
Visual Options Builder
The Visual Builder lets you create and manage option panels from a drag-and-drop admin interface — no PHP required.
How to Use the Builder
- In the WordPress admin sidebar go to Options Builder.
- Click Add New Panel and fill in the panel name, slug, icon, and position.
- Add sections and drag fields into rows. Configure each field’s ID, label, type, default value, and options.
- Click Save Panel — the panel appears immediately as a live admin menu page.
- Tick the Customizer Integration checkbox to mirror the panel into Appearance → Customize.
Bake to PHP
The Bake to PHP button exports any builder panel to a standalone PHP file you can commit to your theme.
- Open any panel in the builder.
- Click Bake to PHP in the top toolbar.
- Copy the generated code into your theme’s functions.php or a dedicated options file.
The exported file is self-contained and has no dependency on the builder — it uses TPMeta_Options::set_args() and set_section() directly, so it works even if the builder is later deactivated.
WordPress Customizer Integration
Any option panel (PHP-registered or builder-created) can be mirrored into Appearance → Customize.
Enable via PHP
>
Enable via the Visual Builder
Open the panel in the builder, check the Customizer Integration checkbox, and save.
Reading Values
Values saved through the Customizer and the admin panel use the same storage ( theme_mod ). Read them identically:
>