Unverified

Name

Users: Create & Delete n New Users in WP Admin [SnipSnip.pro] - SET TO RUN ONCE!

About

<p>CHANGE TO 'ONLY RUN ONCE' – Users: Create &amp; Delete n New Users in WP Admin [SnipSnip.pro] - <a href="https://snipsnip.pro/s/799" target="_blank" rel="nofollow noopener">https://snipsnip.pro/s/799</a> - This creates then deletes a random number of WordPress user accounts so that your next new Admin account is not a low ID like 1, 2, 3, etc. (Now, is this actually important or helpful? Mmm... IDK. I just made it for fun!)</p>

Language

PHP

Rating

Voted: 1 by 1 user(s)

How to Setup Snippet

Set it to Run Once / Single Use. Then run it once, or twice or 10 times. Then when you make your next Admin or any user account, the ID number will be much higher. I basically just use this for fun sometimes on brand new sites.

Link for further information:

The author has provided the following URL that may be helpful to setting up or using this snippet:

https://snipsnip.pro/s/799

Codevault

brandonjp

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Snippet Source:

https://snipsnip.pro/s/799

History

Last modified:

06/09/2024

Important Note

This snippet has the following status:

Unverified

This snippet has not been verified, use with caution and at your own risk. See details provided by author in sidebar and click below to find out more.

Users: Create & Delete n New Users in WP Admin [SnipSnip.pro] - SET TO RUN ONCE!

 
                    
1if (!class_exists('CreateAndDeleteSomeUserAccounts')) {
2 // Users: Create & Delete n New Users in WP Admin [SnipSnip.pro] - https://snipsnip.pro/s/799
3 // This creates then deletes a random number of WordPress user accounts so that your next new Admin account is not a low ID like 1, 2, 3, etc.
4 // (Now, is this actually important or helpful? Mmm... IDK. I just made it for fun!)
5 class CreateAndDeleteSomeUserAccounts {
6 public function __construct() {
7 require_once(ABSPATH . 'wp-admin/includes/user.php');
8 $this->createAndDeleteNNewUsers();
9 }
10 
11 public function createNewUser() {
12 $username = uniqid();
13 $userdata = array(
14 'user_login' => 'x_user_' . $username,
15 'user_pass' => 'x_pass_' . $username,
16 );
17 $user_id = wp_insert_user($userdata);
18 return $user_id;
19 }
20 
21 public function deleteNewUser($id) {
22 wp_delete_user($id);
23 }
24 
25 public function createAndDeleteNewUser() {
26 $user = $this->createNewUser();
27 $this->deleteNewUser($user);
28 }
29 
30 public function createAndDeleteNNewUsers() {
31 $rand = mt_rand(15, 45);
32 for ($i = 0; $i < $rand; $i++) {
33 $this->createAndDeleteNewUser();
34 }
35 }
36 }
37 
38 new CreateAndDeleteSomeUserAccounts();
39}

1

Related Snippets

Please see some snippets below related to this snippet..

Security

AI Verified

1

Disable URL Autocorrect Guessing

Added: 2 months ago

Last Updated: 1 month ago

To disable URL autocorrect guessing in WordPress using a PHP snippet, you can add the following code to your theme's functions.php file:

Security

AI Verified

0

Disable Comments

Added: 2 years ago

Last Updated: 1 year ago

deactivates all Comment functions on WordPress Site<br/>Source: https://help.codesnippets.pro/article/52-disable-comments-in-wordpress-by-roy-eyal

Security

AI Verified

0

Sembunyikan Kolom URL pada Komentar Postingan

Added: 2 months ago

Last Updated: 2 months ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

Unverified

1

Stop the Scroll! Float the Admin Notice Above the Editor in Code Snippets Pro [SnipSnip.pro]

Added: 10 months ago

Last Updated: 1 week ago

<p>Make the admin notice in Code Snippet Pro float above the editor so your page doesn't scroll away every time you save a snippet. <a href="https://snipsnip.pro/s/787" target="_blank" rel="nofollow n...

Security

Unverified

1

Users: Create & Delete n New Users in WP Admin [SnipSnip.pro] - SET TO RUN ONCE!

Added: 10 months ago

Last Updated: 1 week ago

<p>CHANGE TO 'ONLY RUN ONCE' – Users: Create &amp; Delete n New Users in WP Admin [SnipSnip.pro] - <a href="https://snipsnip.pro/s/799" target="_blank" rel="nofollow noopener">https://snipsnip.pro/s/7...

WordPress Admin

AI Verified

1

Randomize a Post Publish Date in the Classic Editor [SnipSnip.pro]

Added: 10 months ago

Last Updated: 10 months ago

<p>Randomize a Post Publish Date in the Classic Editor. Choose between the past 1, 3, 6, 12 months... or customize it to other options. Works in the Classic Editor only for now. <a href="https://snips...