Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Plugin Name: Disable Drag and Drop Image Improved Plugin in WP-Admin for iOS Safari
- * this code snippet goes to wp-content/mu-plugins/disable-drag-and-drop.php file
- */
- define('TARGET_PLUGIN_FILE', 'drag-drop-featured-image-improved/index.php');
- // Helper function to detect iOS Safari
- function is_ios_safari() {
- $user_agent = $_SERVER['HTTP_USER_AGENT'] ?? '';
- $is_ios = (bool) preg_match('/(iPhone|iPod|iPad)/i', $user_agent);
- $is_safari = (bool) preg_match('/Safari/i', $user_agent) && !preg_match('/(CriOS|FxiOS|EdgiOS|OPiOS|GSA)/i', $user_agent);
- return $is_ios && $is_safari;
- }
- // 1. FILTER ACTIVE PLUGINS FOR BOTH FRONTEND & WP-ADMIN
- add_filter('option_active_plugins', function($plugins) {
- if (is_ios_safari()) {
- $key = array_search(TARGET_PLUGIN_FILE, $plugins);
- if ($key !== false) {
- unset($plugins[$key]);
- $plugins = array_values($plugins); // Re-index
- }
- }
- return $plugins;
- });
- // 2. ADMIN DEBUG MESSAGE (Shows banner at top of WP Admin screen on iOS Safari)
- add_action('admin_notices', function() {
- if (is_ios_safari()) {
- echo '<div class="notice notice-warning"><p><strong>MU-Plugin Active:</strong> iOS Safari detected. Target plugin disabled for this session.</p></div>';
- }
- });
Advertisement
Comments
-
- Did someone already use this arbitrage trick? I did it yesterday and it worked and I'm already up a few hundred.
- Check the method here: pastebin.com/MuP7BqCy
- DM me if you need help
Add Comment
Please, Sign In to add comment