WordPress buffering issue

Install WP-CLI and Create Bash Script to Automatically Assign IP After Network Change

Install wp-cli tool:-

wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Check wp-cli tool install or not:

wp --info

making script for update the siteurl and homeurl:-

#!/bin/bash
# Get the local IP address
ip_address=$(hostname -I | awk '{print $1}')
# Display the IP address
echo "Local IP Address: $ip_address"
# Update WordPress options
wp option update siteurl "http://$ip_address" --path=/var/www/html/wordpress --allow-root
wp option update home "http://$ip_address"  --path=/var/www/html/wordpress  --allow-root

save as filename .sh format

mv <filename> /usr/local/bin
chmod +x <filename>

check the script run or not:

bash <filename>
bash sc.sh

making service to resolve the error:-

after run this following commands:-

for check its working or not:-

remember before reboot change your wifi network...

Second Method:-

Third Method:-

Place script in /etc/init.d/ (SysV style):

Last updated