I was thinking of removing/hiding admin-bar from my wordpress (3.1.1) installation.

I visited following link:


I was surprised to see only a single line to remove/hide admin-bar

add_filter( 'show_admin_bar', '__return_false' );

My question is what is __return_false means? why __ and _?

1 Answer 1


WordPress contains built in functions for quickly returning values.

They are intended to be used as a quick built in function that returns a common value to a filter hook such as true, false, or an empty array.

  • __return_false — Returns the Boolean value of false.
  • __return_true — Returns the Boolean value of true.
  • __return_empty_array — Returns an empty PHP array.
  • __return_zero — Returns the integer 0.
  • __return_null — Returns NULL.
  • __return_empty_string — Returns ''.
  • I cannot see a meaningful reason for these constants.
    – Lovor
    Commented Feb 3, 2021 at 14:14
  • 1
    They aren't constant, they're actual functions. This saves you from having to code something like function justToReturnFalse() { return false; }
    – SeBsZ
    Commented Mar 10, 2021 at 8:58
  • 2
    they are mostly useful in writing short anonymous function attached to filters, like \add_filter( 'woocommerce_email_enabled_new_order, '__return_false' );
    – Q Studio
    Commented Dec 13, 2021 at 22:06

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.