Skip to content

child-theme throws an error if the --path argument is set #251

Closed

Description

@michaelandre0

Bug Report

I am trying to create a child theme using the following command:

wp scaffold child-theme child-slug --parent_theme=parent-slug --theme_name="My child theme" --activate --path=../mywpsite/

It then throws this error:

Error: Invalid theme slug specified. The target directory '/home/clients/0000000000/myfolder/../mywpsite/wp-content/themes/child-slug' is not in '/home/clients/0000000000/myfolder/../mywpsite/wp-content/themes'.

  • The command is being run from the folder ~/myfolder/
  • The target wordpress install is located in ~/mywpsite/ so I need to set --path=../mywpsite/

However, if I execute the command directly from the ~/mywpsite/ folder, it works fine, but the folder has to exist before or I get the following error.

Success: Created '/home/clients/0000000000/mywpsite/wp-content/themes/child-slug'.
Error: The theme directory "child-slug" does not exist.

BUT, the folder AND files still have been created.

That being said, I need to have it work with the --path argument, so I'm assuming this is a bug.

How can this be fixed ?

Thank you

Activity

  1. NickStallman commented on May 14, 2020

    @NickStallman

    Just noticed that this issue is the same as mine. #263

    There is a str_replace line that needs to be wrapped with realpath to fix the issue.

  2. added a commit that references this issue on Jun 2, 2022
    2413ee9
  3. swissspidy commented on Nov 10, 2023

    @swissspidy
    Member

    Looks like this is still relevant, but the attached PR got closed by accident.

    It could be restored from https://gist.github.com/danielbachhuber/2951826b5cee4db3c8245ff095d5b7de though.

    @NielsdeBlaauw would you be interested in giving this another go?

  4. ernilambar commented on Apr 22, 2024

    @ernilambar
    Member

    In this issue, are we talking about Windows setup? In Mac, I am not being able to reproduce the mentioned issue.

  5. michaelandre0 commented on Apr 22, 2024

    @michaelandre0
    Author

    In this issue, are we talking about Windows setup? In Mac, I am not being able to reproduce the mentioned issue.

    Since I posted this, and considering how the paths look like I would say it wasn't a Windows environment but I can't remember for sure since it was 4 years ago.
    However I do use Windows for many devs and it could be a possibility.

  6. sarahschopick commented on Jun 15, 2024

    @sarahschopick

    I keep getting an error message that I need to install the parent theme, even though the parent theme is already installed.

  7. ernilambar commented on Jun 20, 2024

    @ernilambar
    Member

    @sarahschopick Is it possible to provide detailed steps to reproduce the issue? And also your setup environment info. Asking because we are not being able to reproduce issue in our local setup.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions