_filter_query_attachment_filenames

The timeline below displays how wordpress function _filter_query_attachment_filenames has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 1.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 6.1

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '4.9.9', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 9.5

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 5.9

/**
 * Filters the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: 8.6

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 5.8

/**
 * Filters the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: 7.8

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 7.2

/**
 * Filters the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .10

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 6.2

/**
 * Filters the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .10

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 5.6

/**
 * Filters the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: 5.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .11

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 4.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .12

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 5.4

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                          DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return string[] The modified array of clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: 3.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .14

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 2.3

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .20

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 2.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .17

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 1.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: .15

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 5.1

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", '$0 OR ( sq1.meta_value $1 $2 )', $clauses['where']);
    return $clauses;
}

WordPress Version: 0.3

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", "\$0 OR ( sq1.meta_value \$1 \$2 )", $clauses['where']);
    return $clauses;
}

WordPress Version: .20

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 0.2

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", "\$0 OR ( sq1.meta_value \$1 \$2 )", $clauses['where']);
    return $clauses;
}

WordPress Version: .18

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 9.3

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", "\$0 OR ( sq1.meta_value \$1 \$2 )", $clauses['where']);
    return $clauses;
}

WordPress Version: .22

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @deprecated 6.0.3
 * @access private
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The unmodified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    _deprecated_function(__FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
    remove_filter('posts_clauses', __FUNCTION__);
    return $clauses;
}

WordPress Version: 4.7

/**
 * Filter the SQL clauses of an attachment query to include filenames.
 *
 * @since 4.7.0
 * @access private
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
 *                       DISTINCT, fields (SELECT), and LIMITS clauses.
 * @return array The modified clauses.
 */
function _filter_query_attachment_filenames($clauses)
{
    global $wpdb;
    remove_filter('posts_clauses', __FUNCTION__);
    // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
    $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
    $clauses['groupby'] = "{$wpdb->posts}.ID";
    $clauses['where'] = preg_replace("/\\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\\'[^']+\\')\\)/", "\$0 OR ( sq1.meta_value \$1 \$2 )", $clauses['where']);
    return $clauses;
}