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>
60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Script simple para migrar metadatos - version rapida
|
|
* Ejecutar: php migrate_fast.php
|
|
*/
|
|
|
|
require_once('/var/www/html/wp-load.php');
|
|
|
|
echo "=== Migracion rapida de metadata ===\n\n";
|
|
|
|
// Solo procesar AUTORES (el mas importante)
|
|
echo "Procesando AUTORES como categorias...\n";
|
|
|
|
$autores = $wpdb->get_results("
|
|
SELECT meta_value as autor, COUNT(*) as cnt
|
|
FROM wp_postmeta
|
|
WHERE meta_key = 'Autor' AND meta_value != '' AND meta_value IS NOT NULL
|
|
GROUP BY meta_value
|
|
ORDER BY cnt DESC
|
|
LIMIT 100
|
|
");
|
|
|
|
$cat_created = 0;
|
|
$assignments = 0;
|
|
|
|
foreach ($autores as $row) {
|
|
$autor = trim($row->autor);
|
|
if (empty($autor)) continue;
|
|
|
|
// Crear o encontrar categoria
|
|
$term = get_term_by('name', $autor, 'category');
|
|
if (!$term) {
|
|
$result = wp_insert_term($autor, 'category', array(
|
|
'slug' => sanitize_title($autor)
|
|
));
|
|
if (is_wp_error($result)) continue;
|
|
$term_id = $result['term_id'];
|
|
$cat_created++;
|
|
} else {
|
|
$term_id = $term->term_id;
|
|
}
|
|
|
|
// Asignar a posts
|
|
$post_ids = $wpdb->get_col($wpdb->prepare("
|
|
SELECT DISTINCT post_id FROM wp_postmeta
|
|
WHERE meta_key = 'Autor' AND meta_value = %s
|
|
", $autor));
|
|
|
|
foreach ($post_ids as $post_id) {
|
|
wp_set_object_terms($post_id, $term_id, 'category', true);
|
|
$assignments++;
|
|
}
|
|
|
|
echo "$autor: $row->cnt posts\n";
|
|
}
|
|
|
|
echo "\nCategorias creadas: $cat_created\n";
|
|
echo "Asignaciones: $assignments\n";
|
|
echo "=== FIN ===\n";
|