Skip to content

Instantly share code, notes, and snippets.

@llipe
Last active July 3, 2024 03:09
Show Gist options
  • Save llipe/c4b28fc626c1135ef23139dfb267a0b9 to your computer and use it in GitHub Desktop.
Save llipe/c4b28fc626c1135ef23139dfb267a0b9 to your computer and use it in GitHub Desktop.

Wordpress Management

Using wp cli is key to an efficient wordpress management. For command reference use the official documentation.

Update wp-cli

wp cli update

Regular CLI maintenance

# Updates wordpress
wp core udpate

# Updates plugins
wp plugin update --all
wp plugin update <plugin name>

# Updates themes
wp theme update --all
wp theme update <theme name>

How to Change Wordpress URL

Ref: https://dotlayer.com/how-to-use-the-wp-cli-command-line-tool-to-change-your-wordpress-website-url-or-domain/

  1. Install wp-cli
  2. Run:
wp option update home 'http://example.com'
wp option update siteurl 'http://example.com'

Done!

Alternative method

Add in wp-config.php

define( 'WP_HOME', 'http://test.domain.cl' );
define( 'WP_SITEURL', 'http://test.domain.cl' );

Recommended alternative for complex migrations

https://developer.wordpress.org/cli/commands/search-replace/

Fix Permissions

Fix de permisos de carpetas desde carpeta public del sitio

Ref: https://codex.wordpress.org/Changing_File_Permissions

sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;
chmod -R 660 wp-config.php

# OR
sudo find . -type f -exec chmod 664 {} \; && sudo find . -type d -exec chmod 775 {} \; && chmod -R 660 wp-config.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment