CustomFonts

/* Plugin Name: MA Custom Fonts Description: Load custom fonts and inject to Gutenberg, Bricks, Oxygen Author: Matthias Altmann Project: Code Snippet MA Custom Fonts Version: 3.4.3 Plugin URI: https://www.altmann.de/en/blog-en/code-snippet-custom-fonts/ Description: en: https://www.altmann.de/en/blog-en/code-snippet-custom-fonts/ de: https://www.altmann.de/blog/code-snippet-eigene-schriftarten/ Copyright: © 2020-2025, Matthias Altmann…Continue reading

_MK – SECURITY – Disable XML-RPC-API

// Disable XML-RPC add_filter( ‘xmlrpc_enabled’, ‘__return_false’ ); // Block access to xmlrpc.php via .htaccess equivalent (Apache fallback) add_action( ‘init’, function () { if (strpos($_SERVER[‘REQUEST_URI’], ‘xmlrpc.php’) !== false) { wp_die( ‘Access denied.’ ); } }); // Remove pingback header add_filter( ‘wp_headers’,…Continue reading

_MK – Last connection

// Enregistre la date de connexion de l’utilisateur function enregistrer_derniere_connexion($user_login, $user) { // Met à jour la date de la dernière connexion $last_login = current_time(‘mysql’); update_user_meta($user->ID, ‘last_login’, $last_login); // Debug: Vérifie si la date est bien enregistrée if (false ===…Continue reading

_MK – SECURITY – Block Author Enumeration

// 🔒 Block ?author=1 user enumeration attempts add_action(‘init’, function () { if (!is_admin() && isset($_GET[‘author’])) { wp_redirect(home_url(), 301); exit; } }); // 🛡️ Disable REST API user exposure add_filter(‘rest_endpoints’, function ($endpoints) { if (isset($endpoints[‘/wp/v2/users’])) { unset($endpoints[‘/wp/v2/users’]); } return $endpoints; });Continue reading

Cleanup_Posts_Categories_Tags_06_30

/* Plugin Name: Daily Cleanup with Report Description: Deletes selected post types, categories, and tags daily, stores summary data for digest reporting, and optionally sends an email confirmation. Version: 1.8 */ function delete_all_posts_categories_tags_with_report() { global $wpdb; // 🕒 Track last…Continue reading

Delete Post, Category, Tag Entries v2

/* Plugin Name: Daily Cleanup with Report Description: Deletes all posts, categories, and tags daily and emails a summary. Version: 1.4 */ function delete_all_posts_categories_tags_with_report() { global $wpdb; // 🕒 Track last cleanup execution time update_option( ‘last_run_cleanup’, current_time( ‘mysql’ ) );…Continue reading

Cron Last Run Notice

add_action( ‘admin_notices’, function() { if ( ! current_user_can( ‘manage_options’ ) ) return; $cleanup_time = get_option( ‘last_run_cleanup’, ‘Never’ ); $purge_time = get_option( ‘last_run_purge’, ‘Never’ ); echo ‘ ‘; echo ‘ 🧹 Cleanup Last Ran: ‘ . esc_html( $cleanup_time ) . ‘‘;…Continue reading

Teste temporário de compatibilidade

add_action( ‘init’, function() { if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { $compat = \Automattic\WooCommerce\Utilities\FeaturesUtil::is_plugin_compatible( ‘custom_order_tables’, ‘ajax-search-for-woocommerce-premium/ajax-search-for-woocommerce.php’ ); add_action( ‘admin_notices’, function() use ( $compat ) { echo ‘ ‘; echo ‘📋 WooCommerce reconhece o FiboSearch como ‘ . ($compat ? ‘compatível…Continue reading

Post Shortcodes

// Est. Reading Time $reading_speed = 200; // 200 words per minute $content = get_post_field( ‘post_content’, get_the_id() ); $word_count = str_word_count( strip_tags( $content ) ); $reading_time = ceil( $word_count / $reading_speed ); function post_read_time_shortcode($atts) { echo ‘ Estimated reading time:…Continue reading