Hot answers tagged

2

If you look at the end of the function get_cancel_comment_reply_link( $text = '' ) in the file wp-includes/comment-template.php, you see the filter cancel_comment_reply_link. return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text ); It may work.


1

In an environment without third party code, get_the_ID() should give you the correct value. It sounds like some plugin is interfering with this. So you can do what they forgot and simply call wp_reset_postdata() in your footer before you need the values.


1

Ok got it, knew there must be some built-in WP solution to this. Simply call wp_get_referer() in your callback (for details, see this). At least it's working as I need it, let me know if there's any better solution. UPDATE Thanks to @Tom J Nowell, we should also mention that referrers could get stripped for privacy reasons or similar. To thus be on the safe ...


Only top voted, non community-wiki answers of a minimum length are eligible