If you're managing dozens or hundreds of WordPress sites on the same server (like a PBN hosting environment), manually creating application passwords for each site is time-consuming. This tutorial shows you how to automate that using WP-CLI.
π What You Need
- Shell or SSH access to your hosting server
- WP-CLI installed globally (ask your hosting provider)
- All WordPress sites located under a common directory (e.g.
/var/www
,/home/user/public_html
)
π Step 1: Detect All WordPress Installs
Run this command to list all directories containing a wp-config.php
file:
find /var/www -name "wp-config.php"
Adjust the path if your installs are located elsewhere.
π Step 2: Generate Application Passwords
Loop through each site and generate an application password for a specified user (e.g., admin
):
#!/bin/bash
for site in $(find /var/www -name "wp-config.php" -exec dirname {} \;); do
echo "Processing $site..."
cd "$site"
wp user application-password create admin "PBN Poster Pro" --porcelain
done
This will output a list of generated passwords, one per WordPress site.
π Tip: Store these in a text file for use in PBN Poster Pro:
echo "$domain|$email|admin|$password" >> app_passwords.txt
π§ Troubleshooting
- Ensure the admin user exists in each site
- Use
--path=/path/to/site
if WP-CLI doesnβt auto-detect - Make sure WordPress REST API is not disabled by security plugins
β Result
You now have a complete list of your WordPress domains and valid app passwords, ready for integration into PBN Poster Pro using the following format:
domain.com|email@example.com|admin|your-generated-password
Need help automating this further or saving credentials to CSV? Contact our support team β we can help you streamline even large PBN setups efficiently.