wpseo_custom_fields_pre_query │ хук-фильтр │ Yoast 1.0

Filter: wpseo_custom_fields_pre_query Filters the custom-fields lookup before the database query runs.

Returning a non-null array short-circuits the default SELECT DISTINCT meta_key query against wp_postmeta. On very large postmeta tables this can be a way to supply a pre-cached list or an alternative query to improve loading times.

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

add_filter( 'wpseo_custom_fields_pre_query', 'wp_kama_wpseo_custom_fields_pre_query_filter', 10, 2 );

/**
 * Function for `wpseo_custom_fields_pre_query` filter-hook.
 * 
 * @param string[]|null $custom_fields Pre-computed list of meta_key names, or null to run the
 *                                    default query.
 * @param int           $limit         The configured result limit; honor it if running a custom
 *                                    query.
 *
 * @return string[]|null
 */
function wp_kama_wpseo_custom_fields_pre_query_filter( $custom_fields, $limit ){
	// filter...
	return $custom_fields;
}
$custom_fields(string[]|null)
Pre-computed list of meta_key names, or null to run the default query.
$limit(int)
The configured result limit; honor it if running a custom query.

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

WPSEO_Custom_Fields::get_custom_fields()
wpseo_custom_fields_pre_query
yoast/inc/class-wpseo-custom-fields.php 55
$fields = apply_filters( 'wpseo_custom_fields_pre_query', null, $limit );

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

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