Remove Optional Script

remove_action( ‘wp_footer’, ‘wpcomsh_footer_rum_js’ ); // remove frontend // remove_action( ‘admin_footer’, ‘wpcomsh_footer_rum_js’ ); // remove backendContinue reading

Admin Dashboard Access

function restrict_dashboard_access() { // Allow AJAX requests to proceed if ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) { return; } // Check if user is not an administrator if ( ! current_user_can( ‘administrator’ ) && is_admin() ) { wp_redirect( home_url()…Continue reading

Protect Elementor Forms

/** * Protect Elementor Forms */ add_action( ‘elementor_pro/forms/validation/email’, function( $field, $record, $ajax_handler ) { // validate email format if ( ! is_email( $field[‘value’] ) ) { $ajax_handler->add_error( $field[‘id’], ‘Invalid Email address, it must be in the format [email protected]’ ); return;…Continue reading

Request Approval to add new Plugins

// Prevent new plugin installations but allow updates to existing plugins add_filter(‘user_has_cap’, ‘prevent_plugin_installation_for_all_users’, 10, 4); function prevent_plugin_installation_for_all_users($allcaps, $cap, $args, $user) { // Prevent plugin installation for all users if (isset($args[0]) && $args[0] === ‘install_plugins’) { $allcaps[$cap[0]] = false; } //…Continue reading

[TEMP] Hide YoOhw Split Order Button

function rd_hide_yoohw_split_order_button() { if ( ! class_exists( ‘WooCommerce_Order_Splitter_Edit_Order_Split_Button’ ) ) { return; } $screen = get_current_screen(); if ( ! $screen ) { return; } $is_legacy_order_edit = ‘shop_order’ === $screen->id; $is_hpos_order_edit = ( function_exists( ‘wc_get_page_screen_id’ ) && wc_get_page_screen_id( ‘shop-order’ ) ===…Continue reading

Disable Action Scheduler Default Queue Runner

if ( ! function_exists( ‘rd_disable_action_scheduler_default_runner’ ) ) { function rd_disable_action_scheduler_default_runner() { if ( class_exists( ‘ActionScheduler’ ) ) { remove_action( ‘action_scheduler_run_queue’, array( ActionScheduler::runner(), ‘run’ ) ); } } } add_action( ‘init’, ‘rd_disable_action_scheduler_default_runner’, 10 );Continue reading

Specify Query Parameters to Ignore during SiteGround Speed Optimizer Cache-Creation and Cache-Spawn

add_filter( ‘sgo_ignored_query_params’, ‘add_sgo_ignored_query_params’); function add_sgo_ignored_query_params( $ignored_query_params ) { // List query parameters to ignore in addition to SiteGround Speed Optimizer default ignore-list. // WooCommerce Order-Received Redirection Order Attribution $ignored_query_params[] = ‘utm_nooverride’; // Third-Party or Plugin-Specific Parameters // MailChimp $ignored_query_params[] =…Continue reading