Parámetro | Detalles |
---|---|
$ consulta | (WP_Query) objeto de bucle |
Si está utilizando PHP 5.3.0 o superior, puede usar cierres ( funciones anónimas )
add_action( 'pre_get_posts', function( $query ) {
if( !$query->is_main_query() || is_admin() ) return;
// this code will run only if
// - this query is main query
// - and this is not admin screen
});