How to return wp_login_form(), not echoing

If you’re using wp_login_form() inside a custom function and you don’t want wp_login_form() to echo, which is by default, you shoud set the echo to false as following:

function custom_login(){
  $acc_menu =  wp_login_form(
    array(
       'echo' => false,
    )
  );
 return $acc_menu;
}

Where Do I Put This Code?

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>