1

I have a custom log-in form and here is the intro to that script:

<?php
    if ( ! is_user_logged_in() ) {
        $args = array(
            'redirect'          => site_url( '/index.php/portal' ), 
            'form_id'           => 'loginform-custom',
            'label_username'    => __( 'Username' ),
            'label_password'    => __( 'Password' ),
            'label_log_in'      => __( 'Log in' ),
            'remember'          => true
        );
?>

When the user makes a failed log-in attempt, they are taken to the WordPress-themed log-in page. How do I keep them on my themed log-in page or direct them to another page?

1 Answer 1

0

If you want to return to the home page of the site, use

site_url()

If you want to return to a specific page or post, and assuming that that page/post is http://yoursite.com/this-is-my-post , then you would want to use

site_url('/this-is-my-post')

If your page name is 'portal', then

site_url('/portal') 

See documentation here: https://codex.wordpress.org/Function_Reference/site_url for some basic examples.

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.