wp_allow_query_attachment_by_filename filter-hookWP 6.0.3

Filters whether an attachment query should include filenames or not.

Usage

add_filter( 'wp_allow_query_attachment_by_filename', 'wp_kama_allow_query_attachment_by_filename_filter' );

/**
 * Function for `wp_allow_query_attachment_by_filename` filter-hook.
 * 
 * @param bool $allow_query_attachment_by_filename Whether or not to include filenames.
 *
 * @return bool
 */
function wp_kama_allow_query_attachment_by_filename_filter( $allow_query_attachment_by_filename ){

	// filter...
	return $allow_query_attachment_by_filename;
}
$allow_query_attachment_by_filename(true|false)
Whether or not to include filenames.

Changelog

Since 6.0.3 Introduced.

Where the hook is called

WP_Query::get_posts()
wp_allow_query_attachment_by_filename
wp-includes/class-wp-query.php 1896
$this->allow_query_attachment_by_filename = apply_filters( 'wp_allow_query_attachment_by_filename', false );

Where the hook is used in WordPress

wp-admin/includes/ajax-actions.php 3060
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
wp-admin/includes/post.php 1370
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
wp-includes/deprecated.php 4545
_deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )' );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 100
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );