wp_allow_query_attachment_by_filename хук-фильтрWP 6.0.3

Filters whether an attachment query should include filenames or not.

Использование

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.

Список изменений

С версии 6.0.3 Введена.

Где вызывается хук

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 );

Где используется хук в WordPress

wp-admin/includes/ajax-actions.php 3064
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
wp-admin/includes/post.php 1372
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 100
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );