Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #302945

    Hi guys,

    I’ve created a custom shortcode for a standard login form to embed on a page. However, it does not display at all unless a user is already logged in. I narrowed it down to an issue with Enfold after changing theme to Twenty Thirteen and finding no hiccups.

    Troubleshooting steps are below:

    • Inserted code for wp_login_form() directly into a custom page template (no shortcode).
    • Disabled all plugins one-by-one via the WordPress interface as well as manually renamed the WordPress’ plugin folder in an attempt to disassociate it.
    • Stripped code to wp_login_form( array( ‘echo’ => false ) ); in an attempt to make it as simple as possible and test insertion.

    The functions.php code is as follows:

    add_shortcode( ‘my_login_form’, ‘my_login_form_shortcode’ );

    function my_login_form_shortcode() {

    $args = array(
    ‘redirect’ => admin_url(),
    ‘form_id’ => ‘loginform’,
    ‘label_username’ => __( ‘Username’ ),
    ‘label_password’ => __( ‘Password’ ),
    ‘label_remember’ => __( ‘Remember Me’ ),
    ‘label_log_in’ => __( ‘Log In’ ),
    ‘remember’ => true

    $attr = shortcode_atts( $defaults, $attr );

    $attr[‘echo’] = false;


    Any ideas?



    I got it working after lots of confusion! I realised that I was using a custom page template when I didn’t really need one. With just a default page template the shortcode works, allowing a login form to appear on any random page despite whether the user is authenticated or not.

    This could still be considered a bug seeing as the custom shortcode wouldn’t appear for unauthenticated users on a page with a custom template applied via an Enfold Child Theme, but it’s no longer an issue for me!

    Thanks anyway guys. Feel free to close the thread.



    Glad you figured it out! Let us know if you have any other questions or issues
    P.S.: Awesome username :)


Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Login form appears blank when unauthenticated’ is closed to new replies.