Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download & Install WordPress via Curl
curl -O https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress site
rm latest.zip
@davidlowry
Copy link

davidlowry commented Jun 30, 2015

Good follow-up to this post - https://gist.github.com/Adirael/3383404

@aymanalzarrad
Copy link

aymanalzarrad commented Dec 1, 2015

Curl will get a corrupted zip if you use the http url as it's moved permanently, so you should instead use the https url:
curl -O https://wordpress.org/latest.zip

@Deftwun
Copy link

Deftwun commented Nov 6, 2018

use curl -LO https://wordpress.org/latest.zip to follow any redirects otherwise you'll download an empty file

@49e94b8f256530dc0d41f740dfe8a4c1

@Deftwun thanks man!

@BobbyRobillard
Copy link

BobbyRobillard commented Jan 1, 2019

use curl -LO https://wordpress.org/latest.zip to follow any redirects otherwise you'll download an empty file

What a legend.

@skoskie
Copy link

skoskie commented Jul 20, 2019

Assuming you want something like the following file structure:

ProjectName/Repo/.git/
                /public/

You can get started really quickly by doing the following:

cd ProjectName/Repo ... this should be an empty directory.

Then run this as one big command:

git init && \
curl https://raw.githubusercontent.com/github/gitignore/master/WordPress.gitignore > .gitignore && \
curl -LO https://wordpress.org/latest.zip && \
unzip latest.zip && \
rm latest.zip && \
mv wordpress public && \
mv ./public/wp-config-sample.php ./wp-config.php

I should note that I keep wp-config.php one level above the web root, which is what the last line does. If that's not your thing, kill the last line and the && \ from the second-to-last line.

Hope that helps someone kick off a new project faster.

@skoskie
Copy link

skoskie commented Jul 20, 2019

... I suppose you could go ahead and add the first commit too.

git add --all && \
git commit -sq -m "Initial commit of Wordpress core files. Hello World."

@BFTrick
Copy link
Author

BFTrick commented Jul 22, 2019

I updated the link in the original code. Thanks @aymanalzarrad!

@kristos80
Copy link

kristos80 commented Feb 15, 2020

For those who want to move the wordpress folder to their current directory, should change:
mv wordpress site to mv wordpress/* ./

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