Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Site Editor not working on Bedrock installs #628

Closed
5 tasks done
MervinPraison opened this issue Feb 1, 2022 · 4 comments
Closed
5 tasks done

Bug: Site Editor not working on Bedrock installs #628

MervinPraison opened this issue Feb 1, 2022 · 4 comments
Labels

Comments

@MervinPraison
Copy link

MervinPraison commented Feb 1, 2022

Terms

Description

What's wrong?

Just bringing to your attention regarding this Site Editor not working for TwentyTwentyTwo Child theme on roots Bedrock.

I have also raised this with WordPress. https://core.trac.wordpress.org/ticket/55015

They are also investigating it.

What have you tried?

  • Deactivated all plugins
  • Tried on Chrome ( including incognito mode ) , Firefox and Safari
  • Still the same issue.

What insights have you gained?

the parent theme is not in the same themes folder as the child theme. Moving twentytwentytwo parent theme into bedrock/web/app/themes will let the Site Editor load

Temporary workarounds

Moving twentytwentytwo parent theme into bedrock/web/app/themes will let the Site Editor load

Steps To Reproduce

  1. Install WordPress 5.9
  2. Install Twenty Twenty Two theme
  3. Create a child theme.
  4. Go to site editor released in WordPress version 5.9
  5. You will see a white screen.

Expected Behavior

Site editor should be loaded

Actual Behavior

White screen

Relevant Log Output

/wp-admin/site-editor.php?postId=twentytwentytwochild%2F%2Findex&postType=wp_template

core-data.js?ver=b4684a7c90f2d858ab7fa74414ad5a54:2721 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'stylesheet')
    at Object.reducer_currentTheme [as currentTheme] (core-data.js:2721:34)
    at eval (eval at <anonymous> (data.js:117:10), <anonymous>:3:107)
    at Object.combinedReducer [as root] (data.js:128:15)
    at eval (eval at <anonymous> (data.js:117:10), <anonymous>:3:67)
    at combinedReducer (data.js:128:15)
    at dispatch (data.js:980:22)
    at data.js:1706:12
    at redux-routine.js:247:16
    at data.js:1636:10
    at Object.dispatch (data.js:1694:10)

Versions

1.19.0

@iamlili
Copy link

iamlili commented Feb 25, 2022

Hi,

I cannot even load the site editor for the main TwentyTwentyTwo theme (using bedrock)

  • I did a clean install of latest Bedrock
  • ensured theme TwentyTwentyTwo was selected
  • navigated to the new site editor (wp/wp-admin/site-editor.php).
    • Got a white page with Error: "The editor is unable to find a block template for the homepage.". Full Error details below

Error: getHomepageParams: HTTP status error, 404 Not Found

at http://demo2.local/wp/wp-includes/js/dist/edit-site.js?ver=403e01f2b098b6a656118a51787581cb:8766:13
at async getHomepageParams (http://demo2.local/wp/wp-includes/js/dist/edit-site.js?ver=403e01f2b098b6a656118a51787581cb:8762:20)
at async redirectToHomepage (http://demo2.local/wp/wp-includes/js/dist/edit-site.js?ver=403e01f2b098b6a656118a51787581cb:8797:28)
at async reinitializeEditor (http://demo2.local/wp/wp-includes/js/dist/edit-site.js?ver=403e01f2b098b6a656118a51787581cb:9067:5)

I tried moving the theme to /web/app/themes, but that did not help.

It works fine with a regular install of WP (without bedrock)

Has anyone experienced this?

@iamlili
Copy link

iamlili commented Feb 28, 2022

For me the site editor doesn't load when you navigate to the link... wp/wp-admin/site-editor.php

This is because when the page first loads, the javascript is trying to ajax http://demo2.local/wp/?_wp-find-template=true (which results in a 404)

Notice the /wp/ in the url. It should really be loading http://demo2.local/?_wp-find-template=true

So this may be a bug with WP code. (not sure if this can be changed within the bedrock code)

The only way i can get the site editor to load is to load it with these extra url parameters
wp/wp-admin/site-editor.php?postType=wp_template&postId=twentytwentytwo%2F%2Fhome

(this bypasses the _wp-find-template request)

@dotsam
Copy link

dotsam commented Feb 28, 2022

This looks to be because the full site editor is passing through site_url() in its settings rather than home_url(), which is of course different in a subfolder installation like Bedrock. This was introduced in WordPress/gutenberg@9c5fe16 in the Gutenberg plugin, which was subsequently pulled in to core in https://core.trac.wordpress.org/ticket/54337, but I assume this probably needs to be opened as a bug in the Gutenberg repo.

For now, this workaround seems to work, but I haven't extensively tested things to see if anything else breaks:

add_filter('block_editor_settings_all', function ($editor_settings) {
  $editor_settings['siteUrl'] = home_url();

  return $editor_settings;
});

@retlehs retlehs changed the title Bug: Site Editor not working for TwentyTwentyTwo Child theme on roots Bedrock Bug: Site Editor not working on Bedrock installs Feb 28, 2022
@retlehs
Copy link
Sponsor Member

retlehs commented May 24, 2022

no longer an issue as of wp 6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants