38. Migrating from Pods | Field Forge - Custom Fields, Built for Speed
Download Log in

38. Migrating from Pods

Developer Guide

Pods Framework stores custom field data either in custom tables or wp_postmeta. Migration approach depends on the storage mode, and remains a manual/beta path until the site’s Pods content types, relationships, and template helper calls are reviewed.

Detection

php
// Check if Pods tables exist
global $wpdb;
$pods_tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->prefix}pods%'" );
$has_pods = ! empty( $pods_tables );

Migration from Pods Meta Storage

When Pods uses wp_postmeta (the default), migration is straightforward:

php
function migrate_pods_to_fieldforge( $post_type, $field_map ) {
    $posts = get_posts( [ 'post_type' => $post_type, 'numberposts' => -1, 'fields' => 'ids' ] );

    foreach ( $posts as $post_id ) {
        foreach ( $field_map as $pods_name => $ff_name ) {
            $value = get_post_meta( $post_id, $pods_name, true );
            if ( '' !== $value && null !== $value ) {
                update_field( $ff_name, $value, $post_id );
            }
        }
    }
}

// Usage: migrate with optional name remapping
migrate_pods_to_fieldforge( 'event', [
    'event_date'     => 'event_date',
    'event_location' => 'venue_address',
    'ticket_price'   => 'price',
] );

Template Updates

php
// Before (Pods)
$pod = pods( 'event', get_the_ID() );
$date = $pod->field( 'event_date' );

// After (Field Forge)
$date = get_field( 'event_date' );

Forge AI Assistant Online

Hi! I'm the Field Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs