WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.29k stars 4.11k forks source link

Child theme on Multisite does not work #61608

Open javiercasares opened 3 months ago

javiercasares commented 3 months ago

Description

When activating a Child Theme in a Multisite it says:

The parent theme is missing. Please install the "abc" parent theme.

Also, the child theme goes to the "Broken" tab.

After doing the "step-by-step"

When you go to the canva part, it broke /wp-admin/site-editor.php?canvas=edit

Related: #58549

Step-by-step reproduction instructions

  1. Install a new WP Multisite with 2 subsites (main + subsite)
  2. Install the Create Block Theme plugin
  3. On the main site, go to the Editor → Create Block Theme → go to the "new" canva editor (using the new options and not the old ones).
  4. Go to the Create new theme from scratch.
  5. Go to the Multisite options and activate the new theme.
  6. Delete all the other themes.
  7. Go, again, to the canva editor, and Create New theme → create a Child theme
  8. Activate the Child Theme as Network (both parent and child may be activated)
  9. Go to the subsite and activate the Child theme

Screenshots, screen recording, code snippet

No response

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

javiercasares commented 3 months ago

One interesting that also happened is, if I install the TT24 theme, and leave it activated on all the sites / subsites and deactivate the parent theme, then, the Child Theme looks like it works because goes from the Broken Tab to the All tab.

javiercasares commented 3 months ago

I think I found it… it needs an "index.php". If there is no file there, it doesn't work.

nicofyve commented 3 months ago

Adding an empty index.php to TT24 on my multisite installation solved the problem for me, too. Thank you @javiercasares !

EDIT: By chance I found another way to work around this issue:

When I encountered the issue mentioned in the OP, I had the plugin Create Theme Block Network Activated.

The OP issue also disappears for me when the plugin Create Theme Block is NOT Network Activated (without the index.php file added to the TT24 theme). It seems fine to have the plugin activated for the individual site.

luminuu commented 3 months ago

Can confirm this is an issue with a missing index.php in a block theme that is used as a parent theme in a multisite environment.

carolinan commented 2 months ago

I am not able to reproduce this using the following steps:

Enable multisite that uses the path, not the subdomain. Network enable the parent theme (twenty twenty-four) and two child themes: one classic, one block. ✅ No issues with either theme on activation.

With the classic theme active, the Site Editor does not load the PHP template from my child theme. The preview looks like it is trying to load something, and there is no message saying that the current template is not editable. Is this what you mean with "When you go to the canva part, it broke /wp-admin/site-editor.php?canvas=edit" @javiercasares?


Using Create Block Theme Version 2.3.0 to create:

1) a new parent block theme directly on the subsite, or 2) a new child block theme directly on the subsite,

redirects me to /wp-admin/site-editor.php?canvas=edit which does not load. It seems more like a plugin problem to me, where it should not be redirecting to canvas=edit ?

carolinan commented 2 months ago

I am testing the same steps on Windows 11:

Manually created child themes:

Both the classic child theme and the block child theme activate without problems or error messages.

Create Block Theme:

After creating the theme and pressing OK to reload the browser, it looks like the theme is active, but its not since it is not network enabled. Refreshing the theme screen in the admin shows that the new theme is not active. Once network enabled, the child theme can be activated without error messages.

carolinan commented 2 months ago

I was able to test sub domains using "Local", WordPress 6.5.5 and 6.6 RC2 on macOS and Windows11, both installations using PHP 8.1.29, and I can not reproduce the issue where the parent theme is missing.

luminuu commented 2 months ago

Have you also checked you had the index.php removed from the parent block theme?

carolinan commented 2 months ago

Yes, neither Twenty Twenty-Four or the parent theme created with create block theme has an index.php.

carolinan commented 2 months ago

My classic child theme that I manually created, did not include theme.json.

luminuu commented 2 months ago

I have been trying to reproduce this but can't do it either.

carolinan commented 2 months ago

There are still multiple issues open for this on Trac though. Perhaps, as suggested in https://core.trac.wordpress.org/ticket/57991, the parent theme was not network enabled?

luminuu commented 2 months ago

Nope, disabling the parent theme network wide does not have any effect on the subsite with the active child theme. It still works for me.

github-actions[bot] commented 1 month ago

Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.