Skip to content

Commit 8882b3a

Browse files
committed
Login: Fix URLs resolving to login subsite instead of wordpress.org.
Use get_rest_url() and get_admin_url() with explicit blog IDs so the MCP config and My Sites link point to the main site rather than the login subsite. Also correct the site_url scheme from login_post to login. git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14696 74240141-8908-4e6f-9713-ba540dce6ec7
1 parent be56084 commit 8882b3a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎wordpress.org/public_html/wp-content/plugins/login-application-passwords/clients/mcp/class-mcp-authorization.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function render_config( string $new_password, array $request, WP_U
6969
'command' => 'npx',
7070
'args' => array( '-y', '@automattic/mcp-wordpress-remote@latest' ),
7171
'env' => array(
72-
'WP_API_URL' => rest_url( 'mcp/wporg' ),
72+
'WP_API_URL' => get_rest_url( 1, 'mcp/wporg' ),
7373
'WP_API_USERNAME' => $user->user_login,
7474
'WP_API_PASSWORD' => WP_Application_Passwords::chunk_password( $new_password ),
7575
),

‎wordpress.org/public_html/wp-content/plugins/login-application-passwords/login-application-passwords.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function ( $hosts ) use ( $allowed_hosts ) {
248248
login_header( $title, '', $wp_error );
249249

250250
?>
251-
<form action="<?php echo esc_url( site_url( 'wp-login.php?action=authorize_application', 'login_post' ) ); ?>" method="post" class="authorize-application-form">
251+
<form action="<?php echo esc_url( site_url( 'wp-login.php?action=authorize_application', 'login' ) ); ?>" method="post" class="authorize-application-form">
252252
<?php wp_nonce_field( 'authorize_application_password' ); ?>
253253
<input type="hidden" name="wp_action" value="authorize_application_password" />
254254
<input type="hidden" name="app_id" value="<?php echo esc_attr( $app_id ); ?>" />
@@ -317,7 +317,7 @@ function ( $hosts ) use ( $allowed_hosts ) {
317317
);
318318
}
319319

320-
printf( wp_kses_post( $message ), esc_url( admin_url( 'my-sites.php' ) ), esc_html( number_format_i18n( $blogs_count ) ) );
320+
printf( wp_kses_post( $message ), esc_url( get_admin_url( array_key_first( $blogs ), 'my-sites.php' ) ), esc_html( number_format_i18n( $blogs_count ) ) );
321321
?>
322322
</p>
323323
<?php

0 commit comments

Comments
 (0)