A
A
amagon2018-04-26 00:34:39
WordPress
amagon, 2018-04-26 00:34:39

Why is the exit function not working?

Good afternoon. I'm trying to add an exit button to the comment add form. Added to function.php

function wph_change_submit_label($defaults) {
 $text_out = mb_convert_encoding('Выйти', 'utf-8', 'cp-1251'); 

$defaults['title_reply'] =

 '<p><h3 id="reply-title" class="comment-reply-title"><a href="' . sprintf( wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) )). '" title=' . sprintf( $text_out). '>' . sprintf( $text_out). '</a></h3></p>';



  
    return $defaults;
}
add_filter('comment_form_defaults', 'wph_change_submit_label');

the exit link appeared, but it simply refers to the current page, something like http://site.ru/article , and when you click on it, the page is simply updated without leaving the session.
What could be the problem why the exit function is not working?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-04-26
@azerphoenix

Hello!
Most likely, there is an error in the synth code, because of which the_permalink link is simply displayed.
Try this code to exit and redirect to Home
Or this one to exit and further redirect to the current page
https://wp-kama.ru/function/wp_logout_url
Also a useful resource - https://wordpress.stackexchange.com/questions/7793...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question