WordPress | Lando

WordPress is open source software you can use to create a beautiful website, blog, or app.

Lando offers a configurable recipe[1] for developing WordPress[2] apps.

Getting Started

Before you get started with this recipe we assume that you have:

  1. Installed Lando[3] and gotten familiar with its basics[4].
  2. Initialized[5] a Landofile[6] for your codebase for use with this recipe.
  3. Read about the various services[7], tooling[8], events[9] and routing[10] Lando offers.

However, because you are a developer and developers never ever RTFM[11], you can also try out this recipe with a vanilla install of WordPress with the commands as shown below:

Configuration

While Lando recipes[12] set sane defaults so they work out of the box, they are also configurable[13].

Here are the configuration options, set to the default values, for this recipe. If you are unsure about where this goes or what this means we highly recommend scanning the recipes documentation[14] to get a good handle on how the magicks work.

Note that if the above config options are not enough, all Lando recipes can be further extended and overriden[15].

Choosing a php version

You can set php to any version that is available in our php service[16]. However, you should consult the WordPress requirements[17] to make sure that version is actually supported by WordPress itself.

The recipe config[18] to set the WordPress recipe to use php version 7.1 is shown below:

Choosing a web server

By default, this recipe will be served by the default version of our apache[19] service but you can also switch this to use nginx[20]. We highly recommend you check out both the apache[21] and nginx[22] services before you change the default via.

With Apache (default)

With nginx

Choosing a database backend

By default, this recipe will use the default version of our mysql[23] service as the database backend but you can also switch this to use mariadb[24] or 'postgres'[25] instead. Note that you can also specify a version as long as it is a version available for use with lando for either mysql, mariadb or postgres.

If you are unsure about how to configure the database, we highly recommend you check out the mysql[26], mariadb[27]and 'postgres'[28] services before you change the default.

Also note that like the configuration of the php version you should consult the WordPress requirements[29] to make sure the database and version you select is actually supported by WordPress itself.

Using MySQL (default)

Using MariaDB

Using Postgres

Using a custom version

Using xdebug

This is just a passthrough option to the xdebug setting[30] that exists on all our php services[31]. The tl;dr is xdebug: true enables and configures the php xdebug extension and xdebug: false disables it.

However, for more information we recommend you consult the php service documentation[32].

Using custom config files

You may need to override our default WordPress config[33] with your own.

If you do this, you must use files that exist inside your application and express them relative to your project root as shown below:

Note that the default files may change based on how you set both ssl and via. Also note that the vhosts and server config will be either for apache or nginx depending on how you set via. We highly recommend you check out both the apache and nginx if you plan to use a custom vhosts or server config. A hypothetical project[34][35]

Note that you can put your configuration files anywhere inside your application directory. We use a config directory but you can call it whatever you want such as .lando in the example below:

Landofile using custom wordpress config

Connecting to your database

Lando will automatically set up a database with a user and password and also set an environment variable called LANDO INFO[36] that contains useful information about how your application can access other Lando services.

The default database connection information for a WordPress site is shown below:

Note that the host is not localhost but database.

You can get also get the above information, and more, by using the lando info[37] command.

Importing Your Database

Once you've started up your WordPress site, you will need to pull in your database and files before you can really start to dev all the dev. Pulling your files is as easy as downloading an archive and extracting it to the correct location. Importing a database can be done using our helpful lando db-import command.

You can learn more about the db-import command over here[38].

By default, each Lando WordPress recipe will also ship with helpful dev utilities.

This means you can use things like wp, composer and php via Lando and avoid mucking up your actual computer trying to manage php versions and tooling.

Usage examples

You can also run lando from inside your app directory for a complete list of commands. This is always advisable as your list of commands may not be 100% the same as above. For example, if you set database: postgres you will get lando psql instead of lando mysql.

wp-config.php

If you are setting up an existing WordPress site you probably need to modify the wp-config.php so that Lando can connect to your database.

Your DB connection info may differ

Note that your database credentials may differ from below since they are customizable. If you have done this we recommend you run lando info first and use the internal_connection information to populate the below values.

Here are a few ways you can modify wp-config.php for usage with Lando. You will want to make sure these go at the TOP of wp-config.php.

1. Hardcode the values

2. Use LANDO_INFO

We also recommend you check out this helpful doc[39] on the wp-config.php file.

keywords

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Linx
Search Linx by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
You want to be the best, you MUST put the long yards in! Nothing comes easy in life so stop wishing and start DOING! So many people would rather bitch and moan than help themselves. Dont be one of those negative drainers, start today, make a small change and keep going forwards with this attitude!
Unknown
Random CSS Property

border-image-source

The border-image-source CSS property sets the source image used to create an element's border image.
border-image-source css reference