85 lines
2.2 KiB
PHP
85 lines
2.2 KiB
PHP
<?php
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Desactivar actualizaciones automáticas
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
if (!defined('AUTOMATIC_UPDATER_DISABLED')) {
|
|
define('AUTOMATIC_UPDATER_DISABLED', true);
|
|
}
|
|
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Optimización de recursos (Heartbeat + Cron)
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
add_action('init', 'alcastromol_admin_optimizations');
|
|
|
|
function alcastromol_admin_optimizations() {
|
|
|
|
// Desactivar Heartbeat en frontend
|
|
if (!is_admin()) {
|
|
wp_deregister_script('heartbeat');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Desactivar pantalla completa en editor de bloques
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
add_action('enqueue_block_editor_assets', 'alcastromol_disable_fullscreen_editor');
|
|
|
|
function alcastromol_disable_fullscreen_editor() {
|
|
|
|
$script = "
|
|
window.onload = function() {
|
|
const isFullscreenMode = wp.data.select('core/edit-post').isFeatureActive('fullscreenMode');
|
|
if (isFullscreenMode) {
|
|
wp.data.dispatch('core/edit-post').toggleFeature('fullscreenMode');
|
|
}
|
|
}";
|
|
|
|
wp_add_inline_script('wp-blocks', $script);
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Categorías y Tags para Media
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
add_action('init', 'alcastromol_media_taxonomies');
|
|
|
|
function alcastromol_media_taxonomies() {
|
|
|
|
register_taxonomy_for_object_type('category', 'attachment');
|
|
register_taxonomy_for_object_type('post_tag', 'attachment');
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Configuración inicial de comentarios
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
function alcastromol_comment_settings() {
|
|
|
|
update_option('comment_moderation', 1);
|
|
|
|
} |