Make WordPress Core

Opened 2 years ago

Last modified 17 months ago

#55691 reviewing defect (bug)

New site editor uses WP_SITEURL instead of WP_HOME

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

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 (21)

#1 @saijsaij
2 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
2 years ago

  • Component changed from Bundled Theme to Themes

#3 @costdev
2 years ago

  • Milestone changed from Awaiting Review to 5.9.4
  • Version changed from 5.9.3 to 5.9

Milestoning for 5.9.4 for visibility.

#4 @audrasjb
2 years ago

  • Milestone changed from 5.9.4 to 6.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
2 years ago

  • Keywords needs-testing added

#6 @johnbillion
2 years ago

  • Keywords needs-patch added

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


2 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.


2 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
23 months ago

  • Summary changed from New theme editor uses WP_SITEURL instead of WP_HOME to New site editor uses WP_SITEURL instead of WP_HOME

#10 @audrasjb
22 months ago

  • Milestone changed from 6.1 to 6.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
18 months ago

It would be great if we have testing instructions.

#12 @robinwpdeveloper
18 months ago

  • Keywords needs-testing-info added

#13 @abmamun007
18 months ago

Some testing instructions might help.

Last edited 18 months ago by abmamun007 (previous) (diff)

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


18 months ago

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


17 months ago

@audrasjb commented on PR #2713:


17 months ago
#16

conflicts resolved

#17 @audrasjb
17 months ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

Self assigning for final review.

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


17 months ago

#19 @audrasjb
17 months 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.


17 months ago

#21 @hellofromTonya
17 months ago

  • Milestone changed from 6.2 to Awaiting 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.

Note: See TracTickets for help on using tickets.