I am pretty new to both Docker and WordPress. I wanted to try use both and connect it to Python via REST API. However to do that I need to switch to developer mode.
I went to the documentation there (https://developer.wordpress.org/apis/wp-config-php/#wp-environment-type) which states that I have to define this variable. I tried doing it through docker-compose.yaml
file as follows:
wordpress:
depends_on:
- db
image: wordpress:latest
restart: always
ports:
- '8000:80'
volumes: ['./:/var/www/html']
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: gruny
WORDPRESS_DB_PASSWORD: mysql-ps
WORDPRESS_DB_NAME: wordpress
WORDPRESS_CONFIG_EXTRA: |
define( 'WP_ENVIRONMENT_TYPE', 'development' );
networks:
- wpsite
The php script sees that and should define it with eval
function:
#wp-config.php
if ($configExtra = getenv_docker('WORDPRESS_CONFIG_EXTRA', '')) {
eval($configExtra);
}
I confirmed that the $configExtra
variable in fact contains the command. However wordpress still doesn’t allow me to work with application passwords.
I tried modifying the wp-config.php
with define( 'WP_ENVIRONMENT_TYPE', 'development' );
but I see no change.
Then I tried to use plugin called ‘Local Development’ which should allow me to change this variable, but nothing happens.
I am on this machine
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.1.0-21-amd64
Is there something I should do to make this work? Something I should delete or restart or something at all?