Correct {answer_link} shortcode in emails
-
I’m not sure whether it’s actually worth posting this, as you seem reluctant to include even the simplest fixes, but here goes!
The {answer_link} shortcode for emails currently has two problems. First, it’s not documented on the DWQA Settings Email tab for New Answer Notifications.
Second, it doesn’t actually link to the answer at all, but simply to the question. The problem here is
line 146
in/inc/Notifications.php
It currently says:
$message = str_replace( '{answer_link}', get_permalink( $question_id ) . '#answer-' . $answer_id, $message );
It should actually say:
$message = str_replace( '{answer_link}', get_permalink( $answer_id ), $message );
Anyone clicking on this link should now be taken to the correct location. I say “should,” but you also need to make another change I suggested months ago: https://wordpress.org/support/topic/suggested-improvement-answer-redirection/
That requires that you change this line in
/inc/template.php
:
wp_safe_redirect( get_permalink( $question_id ) );
to this:
wp_safe_redirect( get_permalink( $question_id ) . '#' . get_the_id() . '');
- The topic ‘Correct {answer_link} shortcode in emails’ is closed to new replies.