-
AuthorPosts
-
August 12, 2014 at 2:42 am #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;
wp_login_form();
}Any ideas?
Cheers!
August 12, 2014 at 10:08 am #303044I 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.
August 12, 2014 at 11:13 am #303093 -
AuthorPosts
- The topic ‘Login form appears blank when unauthenticated’ is closed to new replies.
