2

how can i change function in general-template.php without affecting this core file on this:

if ( ! is_user_logged_in() ) {
    if ( get_option('users_can_register') )
        $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;

to this:

if ( ! is_user_logged_in() ) {
    if ( get_option('users_can_register') )
        $link = $before . '<a href="' . site_url('/profile') . '">' . __('Profile Page') . '</a>' . $after;

1 Answer 1

2

Use the following filter named register:

add_filter( 'register', 'wpse_96892_register_link' );

function wpse_96892_register_link( $link )
{
    if ( is_user_logged_in() )
        return $link;

    return str_replace(
        // search
        array (
            site_url('wp-login.php?action=register', 'login'),
            __('Register')
        ),
        // replacements
        array (
            site_url('/profile'),
            __('Profile Page')
        ),
        $link
    );
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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