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>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?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";
|
||||
Reference in New Issue
Block a user