File Upload Type

// File Upload Type / Kiri Vadivelu / 2026 add_filter( ‘upload_mimes’, function( $mimes ) { return array( ‘jpg|jpeg|jpe’ => ‘image/jpeg’, ‘png’ => ‘image/png’, ‘ico’ => ‘image/x-icon’, ‘webp’ => ‘image/webp’, ‘pdf’ => ‘application/pdf’, // ‘mp3’ => ‘audio/mpeg’, // ‘mp4|m4v’ => ‘video/mp4’,…Continue reading

Max Upload Size

// Max Upload Size / Kiri Vadivelu / 2026 function max_upload_size( $file ) { $max = 9 * 1024 * 1024; // 9 MB if ( $file[‘size’] > $max ) { $file[‘error’] = ‘File exceeds the 9 MB maximum upload…Continue reading

Image Max Pixel

// Image Max Pixel / Kiri Vadivelu / 2026 add_filter(‘wp_handle_upload_prefilter’, ‘image_max_pixel’); function image_max_pixel($file) { $image = getimagesize($file[‘tmp_name’]); if ($image[0] > 4000 || $image[1] > 4000) { $file[‘error’] = ‘Image too large (max 4000×4000).’; } return $file; }Continue reading

Create Private Folder

// Create Private Folder / Kiri Vadivelu / 2026 function create_private_folder() { $upload_dir = wp_upload_dir(); $private_path = trailingslashit( $upload_dir[‘basedir’] ) . ‘private-files’; // Update the status to debug log if ( ! is_dir( $private_path ) ) { $result = wp_mkdir_p(…Continue reading

Admin Activity Log

// File Activity Log / Kiri Vadivelu / 2026 // Log user actions and file modifications // ─── Configuration ────────────────────────────────────────────── define( ‘FAL_LOG_FILE’, WP_CONTENT_DIR . ‘/activity.log’ ); define( ‘FAL_MAX_ENTRIES’, 500 ); // ─── Core Logger ──────────────────────────────────────────────── function fal_log( $action, $meta =…Continue reading

Admin 404 Log

// Admin 404 Log / Kiri Vadivelu / 2026 // Add admin menu function add_404_log_menu() { add_menu_page( ‘404 Error Log’, ‘404 Log’, ‘manage_options’, ‘404-log’, ‘render_404_log_page’, ‘dashicons-megaphone’, 80 ); } add_action( ‘admin_menu’, ‘add_404_log_menu’ ); // Render the page function render_404_log_page() {…Continue reading

Admin Debug Log

// Admin Debug Log / Kiri Vadivelu / 2026 // Ensure debug mode enabled at wp-config // if ( ! defined( ‘WP_DEBUG’ ) ) define( ‘WP_DEBUG’, true ); // if ( ! defined( ‘WP_DEBUG_DISPLAY’ ) ) define( ‘WP_DEBUG_DISPLAY’, false );…Continue reading

Admin Server Log

// Admin Server Log / Kiri Vadivelu / 2026 // Log HTTP requests to a file define( ‘HTTP_LOG_FILE’, WP_CONTENT_DIR . ‘/http-requests.log’ ); function my_log_http_request( $response, $request, $url ) { $log_entry = [ ‘time’ => current_time( ‘mysql’ ), ‘method’ => $request[‘method’],…Continue reading

Admin Email Log

// Admin Email Log / Kiri Vadivelu / 2026 // Register the Admin Menu add_action(‘admin_menu’, ‘register_all_menus’); function register_all_menus() { add_menu_page( ‘Email Log’, ‘Email Log’, ‘manage_options’, // Access for Admin Only ‘smtp-log’, ‘render_smtp_log_page’, ‘dashicons-email-alt’, 99 ); } // Render the Email…Continue reading