__return_true(): true

Returns true.


Description

Useful for returning true to filters easily.

Top ↑

See also


Top ↑

Return

true True.


Top ↑

More Information

Usage:

<?php
// This will add a filter on `example_filter` that returns true
add_filter( 'example_filter', '__return_true' );
?>


Top ↑

Source

File: wp-includes/functions.php. View all references

function __return_true() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
	return true;
}

Top ↑

Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.