Make WordPress Core

Opened 4 years ago

Last modified 16 months ago

#55691 reviewing defect (bug)

New site editor uses WP_SITEURL instead of WP_HOME

Reported by: saijsaij Owned by: audrasjb
Priority: normal Milestone: Awaiting Review
Component: Themes Version: 5.9
Severity: normal Keywords: needs-testing has-patch needs-test-info reporter-feedback
Cc: Focuses: administration

Description

For my development environment I just installed a fresh copy of WordPress using Bedrock and Docker.
With this combination, my WP_HOME (http://wordpress.localhost) is different from my WP_SITEURL (http://wordpress.localhost/wp).

When I want to run the new Editor under "Appearance" I get the error message "The editor is unable to find a block template for the homepage."

Further debugging revealed, that the URL http://wordpress.localhost/wp/?_wp-find-template=true is requested which results in a 404 response.
For this setup, the URL http://wordpress.localhost/?_wp-find-template=true should be called instead as the whole site is reached under the URL http://wordpress.localhost and therefore can supply the requested information.

Change History (22)

#1 @saijsaij
4 years ago

Tried some things more.
In the file wp-admin/site-editor.php on line 54 I changed the site URL to the home URL and it works.

Old:

$custom_settings      = array(
        'siteUrl'                              => site_url(),
        'postsPerPage'                         => get_option( 'posts_per_page' ),
        'styles'                               => get_block_editor_theme_styles(),
        'defaultTemplateTypes'                 => $indexed_template_types,
        'defaultTemplatePartAreas'             => get_allowed_block_template_part_areas(),
        '__experimentalBlockPatterns'          => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
        '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
);

New:

$custom_settings      = array(
        'siteUrl'                              => home_url(),
        'postsPerPage'                         => get_option( 'posts_per_page' ),
        'styles'                               => get_block_editor_theme_styles(),
        'defaultTemplateTypes'                 => $indexed_template_types,
        'defaultTemplatePartAreas'             => get_allowed_block_template_part_areas(),
        '__experimentalBlockPatterns'          => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
        '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
);

And least now I can see the editor. Other side effects I didn't see right now.

#2 @SergeyBiryukov
4 years ago

  • Component Bundled ThemeThemes

#3 @costdev
4 years ago

  • Milestone Awaiting Review5.9.4
  • Version 5.9.35.9

Milestoning for 5.9.4 for visibility.

#4 @audrasjb
4 years ago

  • Milestone 5.9.46.1

Moving this ticket to next major release since it wasn't addressed during this cycle. Anyone is welcome to move it back to 6.0.x minor releases cycle if a patch is ready to ship.

#5 @azouamauriac
4 years ago

  • Keywords needs-testing added

#6 @johnbillion
4 years ago

  • Keywords needs-patch added

This ticket was mentioned in PR #2713 on WordPress/wordpress-develop by rolf-yoast.


4 years ago
#7

  • Keywords has-patch added; needs-patch removed

Replace site_url with home_url so that the editor can find the templates

Trac ticket: https://core.trac.wordpress.org/ticket/55691

This ticket was mentioned in PR #2717 on WordPress/wordpress-develop by enricobattocchi.


4 years ago
#8

Prevents a fatal error when you to access the site editor in a WP installation where the home URL is different than the site URL.

Trac ticket: https://core.trac.wordpress.org/ticket/55691

#9 @poena
4 years ago

  • Summary New theme editor uses WP_SITEURL instead of WP_HOMENew site editor uses WP_SITEURL instead of WP_HOME

#10 @audrasjb
4 years ago

  • Milestone 6.16.2

With WP 6.1 RC 1 scheduled tomorrow (Oct 10, 2022), there is not much time left to address this ticket. Let's move it to the next milestone.

Ps: if you were about to send a patch and if you feel it is realistic to commit it in the next few hours, please feel free to move this ticket back to milestone 6.1.

#11 @robinwpdeveloper
4 years ago

It would be great if we have testing instructions.

#12 @robinwpdeveloper
4 years ago

  • Keywords needs-testing-info added

#13 @abmamun007
4 years ago

Some testing instructions might help.

Last edited 4 years ago by abmamun007 (previous) (diff)

This ticket was mentioned in Slack in #core-test by robinwpdeveloper. View the logs.


4 years ago

This ticket was mentioned in Slack in #core by costdev. View the logs.


4 years ago

@audrasjb commented on PR #2713:


4 years ago
#16

conflicts resolved

#17 @audrasjb
4 years ago

  • Owner set to audrasjb
  • Status newreviewing

Self assigning for final review.

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.


4 years ago

#19 @audrasjb
4 years ago

  • Keywords reporter-feedback added

Hi, I tried to reproduce the issue by moving WordPress to a sub folder, and I wasn't able to get any error when navigating to the site editor.

@saijsaij are you still able to replicate the issue using WP 6.2 beta 3?

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


4 years ago

#21 @hellofromTonya
4 years ago

  • Milestone 6.2Awaiting Review

Moving this ticket back to Awaiting Review. Why?

  • @audrasjb wasn't able to reproduce the issue.
  • Needs reporter-feedback.
  • No commits have been made yet.

Once it's able to be reproduced, then it can be moved into a milestone for resolution.

#22 @wordpressdotorg
16 months ago

  • Keywords needs-test-info added; needs-testing-info removed
Note: See TracTickets for help on using tickets.