WP HOOKS
filtrdynamicznyod 2.5.0

get_{$adjacent}_post_sort

Args 3Plik wp-includes/link-template.php

Opis — z kodu źródłowego

Filters the ORDER BY clause in the SQL for an adjacent post query.

The dynamic portion of the hook name, $adjacent, refers to the type of adjacency, 'next' or 'previous'. Possible hook names include:

  • get_next_post_sort
  • get_previous_post_sort

Hook dynamiczny — możliwe nazwy

get_next_post_sortget_previous_post_sort

Parametry

ParametrTypOpis
$order_bystringThe <code>ORDER BY</code> clause in the SQL.
$post\WP_PostWP_Post object.
$orderstringSort order. 'DESC' for previous post, 'ASC' for next.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'get_{$adjacent}_post_sort', 'twoja_funkcja', 10, 3 );

function twoja_funkcja($param_1, $param_2, $param_3) {
	// Twój kod
}

Popularne w tej kategorii