• bubokko

    (@bubokko)


    Whenever I run a wp-env start command, I’m getting this warning:

    Warning: could not find a .wp-env.json configuration file and could not determine if '/Users/me/www/my-plugin' is a WordPress installation, a plugin, or a theme.

    How do I tell wp-env that my project is a theme or a plugin? My understanding after reading the docs was that wp-env would figure it out itself.

    • This topic was modified 1 year ago by bubokko.
Viewing 7 replies - 1 through 7 (of 7 total)
  • @bubokko you can create a .wp-env.json file in the root directory of your project and explicitly declare that it’s a theme. See the config file documentation for help setting that up.

    As a side note, if you have a theme file make sure it has the required header at the top of the theme so that WordPress will know what it is.

    Thread Starter bubokko

    (@bubokko)

    @DennisSnell I even tried to copy existing built-in theme and rename it, but I’m still getting this warning. It makes me curious, not gonna lie. Is wp-env supposed to acknowledge a theme by style.css headers? That’s what I thought, but it doesn’t seem to be working. Also tried to copy Akismet as another project, but it also raised that warning. Am I missing something?

    @bubokko is the directory with your code posted somewhere? what does the list of files in the project root look like?

    If you only have theme files then yes, it should find the style.css file and look for the header there.

    Thread Starter bubokko

    (@bubokko)

    @dmsnell I downloaded newest WordPress (6.4.1), copied the folder of Twenty Twenty-Four theme, pasted it in my ~/www directory as ~/www/my-theme, so my-theme is the root of the theme, for example style.css is at ~/www/my-theme/style.css. Then I ran wp-env start on the ~/www/my-theme/ folder, but got the warning nevertheless.

    @bubokko after some experimentation I’m also seeing that error message, but it also appears to be working. That is, even though it prints that warning, it’s still mounting my theme the way I expect it to. I installed 6.4.1 and then copied the twentytwentyfour theme into a new directory, then I renamed the theme to twentytwentyfourohfour just to make sure it wasn’t loading a theme from the wp-env contents.

    So you might double-check and see if it’s working for you. That warning shows up whenever it doesn’t find a .wp-env.json file, even if it finds themes and plugins, which I confirmed by digging into wp-env directly. I think it would make sense to show something clearer like Found the "twentytwentyfour" theme.

    I’ve proposed an update to wp-env to clarify the warning message.

    Thread Starter bubokko

    (@bubokko)

    @dmsnell I checked and indeed my theme was interpreted correctly, however it wasn’t selected as a default theme. I needed to select it in wp-admin myself. Is this expected?

    I’d like to understand if, historically, this wp-env warning wasn’t there? It’s a little misleading if it says that it could not determine if it’s a theme or a plugin, while at the same time interpreting the theme correctly. Not sure if it’s a bug or a feature ??

    It looks like that warning has been there a long time. I’m not sure why it was added the way it was, but it could be simply that this scenario didn’t come up when developing it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to tell wp-env that my project is a theme?’ is closed to new replies.