Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vijayhardaha/05351124b7eb10066cc5948f3ab16eaa to your computer and use it in GitHub Desktop.
Save vijayhardaha/05351124b7eb10066cc5948f3ab16eaa to your computer and use it in GitHub Desktop.
Reinstall WordPress Core (Skip Content) Forcefully

Reinstall WordPress Core (Skip Content) Forcefully

Occasionally, you might need to reinstall the WordPress core files without affecting your website's content. This alias, wp-reinstall, simplifies the process of downloading and reinstalling the WordPress core files, excluding the content directory, to ensure a fresh core installation.

How to Use the Alias

You can use the wp-reinstall alias in your terminal to trigger the WordPress core reinstallation. Here are the steps:

  1. Open Your Terminal: Launch your terminal or command prompt.

  2. Add the Alias to Your Shell Configuration:

    • Bash or Zsh:

      a. Open your shell configuration file (~/.bashrc, ~/.bash_profile, or ~/.zshrc) using your preferred code editor.

      b. Copy and paste the following alias definition at the end of your shell configuration file:

      alias wp-reinstall="wp core download --skip-content --force"

      c. Save the changes and close the editor.

      d. Reload your shell configuration for the changes to take effect:

      • For Bash:

        source ~/.bashrc
      • For Zsh:

        source ~/.zshrc
  3. Run the Alias: After adding the alias to your shell configuration, you can execute the wp-reinstall alias in your terminal:

    wp-reinstall

    This command will download and reinstall the WordPress core files while skipping the content directory, ensuring a clean core installation.

Conclusion

The wp-reinstall alias is a handy tool for WordPress developers and administrators who need to quickly and forcefully reinstall the WordPress core files without affecting the content. It simplifies the process and ensures that your website's core is up to date and functioning correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment