Files
feadulta/wordpress/create_folder.php
T
rafa 668d973889 Initial commit — migración Joomla→WordPress feadulta.org
Incluye: mu-plugins custom (fea-homepage, carta-semana), scripts de
migración/traducción/deploy, documentación de auditoría, análisis de
cartas y HTML de evangelios exportados desde Joomla.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 08:33:12 -04:00

37 lines
1010 B
PHP

<?php
global $wpdb;
// Define table names
$fbv_table = $wpdb->prefix . 'fbv';
$fbv_rel_table = $wpdb->prefix . 'fbv_attachment_folder';
// Folder details
$folder_name = 'Publi';
$parent_id = 0;
$created_by = 1; // Assuming admin user ID 1
// Check if folder exists
$existing = $wpdb->get_row( $wpdb->prepare("SELECT id FROM $fbv_table WHERE name = %s AND parent = %d", $folder_name, $parent_id) );
if ($existing) {
echo "Folder 'Publi' already exists with ID: " . $existing->id . "\n";
$folder_id = $existing->id;
} else {
// Insert new folder
$wpdb->insert(
$fbv_table,
array(
'name' => $folder_name,
'parent' => $parent_id,
'type' => 0,
'ord' => 0,
'created_by' => $created_by
)
);
$folder_id = $wpdb->insert_id;
echo "Created folder 'Publi' with ID: " . $folder_id . "\n";
}
// Write the folder ID to a file so we can use it later
file_put_contents('/tmp/fbv_folder_id.txt', $folder_id);
?>