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(
       '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 comment

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