Credits Shortcode: Remove trailing double slash from profile URLs#645
Credits Shortcode: Remove trailing double slash from profile URLs#645huzaifaalmesbah wants to merge 1 commit into
Conversation
The profiles URL template already includes a trailing slash (`%s/`), so appending another `/` in the shortcode resulted in `//` in the href.
There was a problem hiding this comment.
Pull request overview
This PR fixes malformed contributor profile links generated by the [wpcredits] shortcode by removing an extra trailing slash that resulted in // at the end of profile URLs.
Changes:
- Remove redundant
'/’concatenation when building contributor profile links so the existing%s/URL template is used as-is.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $output = array(); | ||
| foreach ( $props as $username => $name ) { | ||
| $output[] = '<a href="' . sprintf( $results['data']['profiles'], $username ) . '/">' . $name . '</a>'; | ||
| $output[] = '<a href="' . sprintf( $results['data']['profiles'], $username ) . '">' . $name . '</a>'; |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Summary
[wpcredits]shortcode was generating profile URLs with a double trailing slash (//), e.g.https://profiles.wordpress.org/username//wp-credits.phpalready includes a trailing slash (%s/), so the extra/appended inshortcode.phpwas redundant/concatenation from the anchorhrefoutputTest plan
[wpcredits 7.0 class="has-small-font-size" exclude="ideag"]on a pagehttps://profiles.wordpress.org/{username}/(single trailing slash)