__return_true() WordPress Function
The __return_true() function is a simple function that returns the boolean value true. This function is often used as a placeholder for other functions that have not yet been implemented.
__return_true() #
Returns true.
Description
Useful for returning true to filters easily.
See also
Return
(true) True.
More Information
Usage:
<?php // This will add a filter on `example_filter` that returns true add_filter( 'example_filter', '__return_true' ); ?>
Source
File: wp-includes/functions.php
function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore return true; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |