Plugins bloques
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Desinstalación del plugin
|
||||
*
|
||||
* @package Bloques_Transicion
|
||||
*/
|
||||
|
||||
// Si no se llama desde WordPress, salir
|
||||
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Eliminar opciones del plugin
|
||||
delete_option('bloques_transicion_activated');
|
||||
delete_option('bloques_transicion_version');
|
||||
|
||||
// Nota: No eliminamos los CPTs ni taxonomías por defecto
|
||||
// para preservar el contenido del usuario.
|
||||
// Si se desea eliminar todo el contenido, descomentar las siguientes líneas:
|
||||
|
||||
/*
|
||||
// Eliminar todos los posts de los CPTs
|
||||
$post_types = ['actuacion', 'recurso_bloques', 'evento_bloques'];
|
||||
foreach ($post_types as $post_type) {
|
||||
$posts = get_posts([
|
||||
'post_type' => $post_type,
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => 'any',
|
||||
]);
|
||||
|
||||
foreach ($posts as $post) {
|
||||
wp_delete_post($post->ID, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Eliminar taxonomías
|
||||
$taxonomies = ['iniciativa', 'linea_trabajo', 'tipo_evento'];
|
||||
foreach ($taxonomies as $taxonomy) {
|
||||
$terms = get_terms([
|
||||
'taxonomy' => $taxonomy,
|
||||
'hide_empty' => false,
|
||||
]);
|
||||
|
||||
foreach ($terms as $term) {
|
||||
wp_delete_term($term->term_id, $taxonomy);
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user