enhancement(header): link site name to wp-admin#151
Open
faisalahammad wants to merge 1 commit into
Open
Conversation
- Add adminUrl to pressThisData, defaulting to admin_url() - New press_this_site_link_url filter lets the link be customized - Header site name now opens the dashboard; View Site menu item keeps the front-end URL - Guard html() with die() only outside PHPUnit so helper tests can capture output Resolves WordPress#4 Signed-off-by: Faisal Ahammad <faisalahammad24@gmail.com>
faisalahammad
force-pushed
the
enhancement/4-site-link-to-admin
branch
from
July 11, 2026 20:21
c2f1131 to
986b08f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The site name in the Press This header linked to the site front-end (
home_url()) instead of wp-admin, leaving no quick way back to the dashboard. The header site name now openswp-admin, and the link is filterable.Resolves #4
Changes
class-wp-press-this-plugin.php
Before:
After:
Why: Adds a new
adminUrlkey defaulting to the dashboard, with apress_this_site_link_urlfilter so the link target can be changed without overriding the data array. The existingsiteUrlkey is untouched, so the standalone-mode "View Site" menu item still points to the front-end.src/App.js + src/components/Header.js
Before:
After:
Why: The site name link uses
adminUrlwith asiteUrlfallback for backward compatibility. App passesadminUrl={ data.adminUrl }through to the Header.Also guarding
html()so it returns instead ofdie()whenPRESS_THIS_PHPUNITis defined, which lets the existing test helper capturewindow.pressThisData. This fixed a broken JSON-extraction regex in two test helpers that never ran to completion before.Testing
Test 1: Site name opens wp-admin
…/wp-admin/(dashboard)Result: link points to wp-admin, not the front-end
Test 2: View Site still opens front-end
Result: opens the public front-end (
home_url)Test 3: Filter override (optional)
functions.phpor mu-plugin:Result: link follows the filtered URL
Tests already passing
composer test:php— new adminUrl tests pass (1 pre-existing unrelated failure intest_generic_error_messages_hide_details, a DNS/environment artifact)npm run test:unit— 368 pass, including new Header site-link testsnpm run build— assets rebuilt