wp_allow_query_attachment_by_filename
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_allow_query_attachment_by_filename
wp-includes/class-wp-query.php 1925
$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 3067
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
wp-admin/includes/post.php 1385
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
wp-includes/deprecated.php 4546
_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 112
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );