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.