• Resolved mikeor26

    (@mikeor26)


    I am using wp-env 11.4.0 , with wp-cli 2.12.0, on ubuntu 24.04 x64, with PHP 8.3.

    I must use a specific version of wordpress 6.8.1.

    My question is how to automate the WordPress settings for date-format, time-format, permalinks structure from the .wp-env.json when wp-env builds a new environment.

    I am able to do these settings actions via wp-admin but I seek instead to have these automated to reduce manual steps.

    I think it might be possible via an afterStart script containing something similar to wp-env run cli wp option update ... but I do not know if there are options specifically for the wordpress date-format, time-format, and permalinks structure.

    I am a newbie to WordPress, hence this query.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mikeor26

    (@mikeor26)

    I received email replies, but I cannot see these responses here in this forum.

    Thank you to users who replied, indicating that my approach is OK to use an afterStart script , and giving me the option details viz:

    wp-env run cli wp option update date_format 'Y-m-d'
    wp-env run cli wp option update time_format 'H:i'
    wp-env run cli wp option update permalink_structure '/%postname%/'
    wp-env run cli wp rewrite flush --hard

    These commands had the desired effect when run from the afterStart script.

    Marking this question as resolved.

    Yes, you can automate this using wp-cli in an afterStart script within .wp-env.json.
    Use commands like wp option update date_format, time_format, and wp rewrite structure '/%postname%/' --hard to set your preferences.
    This ensures every new environment is configured consistently without manual wp-admin changes.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.