WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 7 weeks ago

#54216 new defect (bug)

missing base href in wp-admin

Reported by: danielrufde Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: administration Cc:

Description

I'm currently testing WordPress with a custom setup using the built-in PHP webserver (php -S localhost:8080 -t .) and I stumbled upon a problem.

When I access http://localhost:8080/wp-admin everything looks fine. But the links point to options-general.php, edit.php, plugins.php and so on which results in http://localhost:8080/options-general.php, http://localhost:8080/edit.php, http://localhost:8080/plugins.php and so on.

Only on http://localhost:8080/wp-admin/index.php and http://localhost:8080/wp-admin/ the links result in http://localhost:8080/wp-admin/options-general.php and so on.

I am aware that the PHP built-in webserver should normally not be used but I have to use it since there are several issues with the WP CLI like https://github.com/wp-cli/server-command/issues/71 and I just need a small local demo setup using github.com/DanielRuf/run-local-wordpress.

I added the missing base metatag in the wp_admin_bar_header function using a simple echo "<base href=\"".admin_url()."\">";

I suggest to add an option to enable the output of the needed base tag.

This trac issue is created as according to https://wordpress.org/support/topic/missing-base-href-in-wp-admin-needed-for-php-built-in-webserver/#post-14932543 this should be reported as "bug" or trac issue in the WordPress core.

Attachments (1)

54216.diff (3.1 KB) - added by sabbirshouvo 7 weeks ago.
modify wp-admin/menu-header.php & replace all internal link with admin_url( $relative_url )

Download all attachments as: .zip

Change History (4)

#1 follow-up: @sabbirshouvo
7 weeks ago

  • Keywords has-patch added

Proper way should be editing wp-admin/menu-header.php and making sure every url is encapsulated with admin_url()

@sabbirshouvo
7 weeks ago

modify wp-admin/menu-header.php & replace all internal link with admin_url( $relative_url )

#2 in reply to: ↑ 1 @danielrufde
7 weeks ago

Replying to sabbirshouvo:

Proper way should be editing wp-admin/menu-header.php and making sure every url is encapsulated with admin_url()

Thanks for this information. Indeed, this sounds like the proper solution.

Note: See TracTickets for help on using tickets.