Opened 3 years ago
Last modified 3 years ago
#54216 new defect (bug)
missing base href in wp-admin
Reported by: | anonymized_17880307 | 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)
Change History (4)
@
3 years ago
modify wp-admin/menu-header.php
& replace all internal link with admin_url( $relative_url )
#2
in reply to:
↑ 1
@
3 years ago
Replying to sabbirshouvo:
Proper way should be editing
wp-admin/menu-header.php
and making sure every url is encapsulated withadmin_url()
Thanks for this information. Indeed, this sounds like the proper solution.
#3
@
3 years ago
Tested the patch locally, looks good on my side (see the resulting URL on the bottom left).
before patch:
https://user-images.githubusercontent.com/827205/137219351-77e5f68a-64db-4588-89ec-82f0d1e61069.png
after patch:
https://user-images.githubusercontent.com/827205/137219364-10d569cc-6ca8-4bfd-8ec7-cc988e9b66d1.png
Proper way should be editing
wp-admin/menu-header.php
and making sure every url is encapsulated withadmin_url()