Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I was editing a wordpress theme. Where i need to replace default wp login link with custom login link.

Problem is, comment_reply_link() function is returning the default link. And i dont want to edit wp-include/comment-template.php

Is there any other way, so that without manipulation of any wordpress file i can replace the default login url.

I already had tried

apply_filters('login_url', $login_url,get_permalink());

before calling comment_reply_link(). But it is not filtering resulting URL.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

you can simple make a check if user is logged in and show him the reply button, if is not you can show him a custom link to your login file.

something like this:

<?php if ( !is_user_logged_in() ) : ?>
    <a href="<?php bloginfo('url'); ?>/login"><?php _e('Reply', 'artdev'); ?></a>
<?php else : ?>
    <?php comment_reply_link() ?>
<?php endif ?>  
share|improve this answer
add comment

I am not sure if you copy/pasted wrong line or misunderstanding how to add filter. apply_filters() runs actual hook, to attach your function to the hook you use add_filter().

It should be something like that:

add_filter('login_url','custom_login_url');

function custom_login_url($login_url) {

    return 'your url';
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.