668d973889
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>
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
global $wpdb;
|
|
|
|
// Define table names
|
|
$fbv_table = $wpdb->prefix . 'fbv';
|
|
$fbv_rel_table = $wpdb->prefix . 'fbv_attachment_folder';
|
|
|
|
// Folder ID from previous step (or hardcoded to 1)
|
|
$folder_id = 1;
|
|
|
|
// Attachment ID (or list of IDs)
|
|
$attachment_ids = [26913];
|
|
|
|
foreach ($attachment_ids as $attachment_id) {
|
|
// Check if relationship exists
|
|
$existing = $wpdb->get_row( $wpdb->prepare("SELECT folder_id FROM $fbv_rel_table WHERE attachment_id = %d", $attachment_id) );
|
|
|
|
if ($existing) {
|
|
// Update existing relationship
|
|
$wpdb->update(
|
|
$fbv_rel_table,
|
|
array('folder_id' => $folder_id),
|
|
array('attachment_id' => $attachment_id)
|
|
);
|
|
echo "Updated attachment $attachment_id to folder $folder_id\n";
|
|
} else {
|
|
// Insert new relationship
|
|
$wpdb->insert(
|
|
$fbv_rel_table,
|
|
array(
|
|
'folder_id' => $folder_id,
|
|
'attachment_id' => $attachment_id
|
|
)
|
|
);
|
|
echo "Assigned attachment $attachment_id to folder $folder_id\n";
|
|
}
|
|
}
|
|
?>
|