Verwalten Sie Field Forge-Daten über die Befehlszeile mit wp eval.
Alle Feldgruppen in JSON exportieren
bash
wp eval 'echo FIELDFORGE_Local_JSON::instance()->save_all();'Synchronisierungsstatus überprüfen
bash
wp eval '$d = FIELDFORGE_Local_JSON::instance()->get_diff(); print_r($d);'Synchronisierung von JSON zur DB erzwingen
bash
wp eval 'FIELDFORGE_Local_JSON::instance()->sync("json_to_db");'Alle Feldgruppen auflisten
bash
wp eval '
$groups = FIELDFORGE_Field_Groups::instance()->get_all();
foreach ( $groups as $g ) {
$fields = json_decode( $g->fields, true );
printf( "#%d: %s (%d fields)\n", $g->id, $g->title, count( $fields ) );
}
'Feldwerte für einen Beitrag abrufen
bash
wp eval '
$fields = get_fields( 42 );
foreach ( $fields as $name => $value ) {
printf( "%s = %s\n", $name, is_array( $value ) ? json_encode( $value ) : $value );
}
'Massenaktualisierung von Feldwerten
bash
wp eval '
$posts = get_posts( [ "post_type" => "product", "numberposts" => -1, "fields" => "ids" ] );
foreach ( $posts as $id ) {
$price = (float) get_field( "price", $id );
update_field( "price", $price * 1.1, $id );
}
echo count( $posts ) . " products updated.\n";
'ACF-Migration ausführen
bash
wp eval '
$imp = FIELDFORGE_ACF_Import::instance();
$det = $imp->detect();
printf( "Found: %d groups, %d fields, %d posts\n", $det["groups"], $det["fields"], $det["posts_with_values"] );
$res = $imp->import_groups();
printf( "Migrated: %d groups, %d errors\n", $res["migrated"], $res["errors"] );
'Field Forge-Cache leeren
bash
wp eval 'FIELDFORGE_Performance::instance()->flush_all(); echo "Cache flushed.\n";'—