Skip to content

Add $context parameter to get_edit_comment_link() to get the URL without HTML entities #7071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fed7131
Update link-template.php
deepakrohillas Jul 23, 2024
a00f565
Update link-template.php
deepakrohillas Jul 23, 2024
2444f46
Merge branch 'WordPress:trunk' into add_context_to_get_edit_comment_link
deepakrohillas Jul 23, 2024
5a38b83
Update link-template.php
deepakrohillas Jul 23, 2024
94b0b3a
Update link-template.php
deepakrohillas Jul 23, 2024
843c635
Suggested changes performed
deepakro Jul 24, 2024
fb7d99b
Update src/wp-includes/link-template.php
deepakrohillas Jul 24, 2024
750f156
Update src/wp-includes/link-template.php
deepakrohillas Jul 25, 2024
5b5d27a
Test case along with some modification in existing function due to fi…
deepakrohillas Jul 25, 2024
4e255de
Test case along with some modification in existing function due to fi…
deepakrohillas Jul 25, 2024
13c53a4
Test case along with some modification in existing function due to fi…
deepakrohillas Jul 25, 2024
737d7f2
Test case along with some modification in existing function due to fi…
deepakrohillas Jul 27, 2024
92a8f05
Test case along with some modification in existing function due to fi…
deepakrohillas Jul 27, 2024
749f0fc
Update src/wp-includes/link-template.php
deepakrohillas Jul 31, 2024
b56e1fe
Added comment
deepakrohillas Jul 31, 2024
a4a80e0
Added comment
deepakrohillas Jul 31, 2024
a0edace
suggested changes performed and test case also modified
deepakrohillas Aug 7, 2024
231f247
Enhance documentation.
felixarntz Aug 9, 2024
d612ea6
Minor test class fixes.
felixarntz Aug 9, 2024
b9d6b85
Merge branch 'trunk' into add_context_to_get_edit_comment_link
felixarntz Aug 9, 2024
f83b20f
Fix return value to be void as before, and enhance tests documentation.
felixarntz Aug 9, 2024
968b8ce
Rename comment_ids property to comment_id.
felixarntz Aug 9, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/wp-includes/link-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1597,16 +1597,23 @@ function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = fals
* @since 2.3.0
*
* @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
* @param string $context Optional. Could be output the '&' character or 'display', Default '&'.
* @return string|void The edit comment link URL for the given comment.
*/
function get_edit_comment_link( $comment_id = 0 ) {
function get_edit_comment_link( $comment_id = 0, $context = 'display' ) {
$comment = get_comment( $comment_id );

if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
return;
}

$location = admin_url( 'comment.php?action=editcomment&c=' ) . $comment->comment_ID;
if ( 'display' === $context ) {
$action = 'comment.php?action=editcomment&c=';
} else {
$action = 'comment.php?action=editcomment&c=';
}

$location = admin_url( $action ) . $comment->comment_ID;

/**
* Filters the comment edit link.
Expand Down
Loading