Skip to content

Actions and filters

Ordering: 8 hooks.

Every hook here has a description in the source.

2 actions6 filters

filter

davo_ignore_get_terms_orderby

Filters whether manual ordering leaves a term query's ORDER BY alone. Defaults to false.

Parameters of davo_ignore_get_terms_orderby
ParameterTypeDescription
$ignoreboolWhether to skip manual term ordering.
$orderbystringThe query's ORDER BY clause.
$argsarray<string, mixed>The term query arguments.

Returns bool

add_filter
add_filter( 'davo_ignore_get_terms_orderby', 'my_filter_callback', 10, 3 );

/**
 * @param bool $ignore
 * @param string $orderby
 * @param array<string, mixed> $args
 */
function my_filter_callback( $ignore, $orderby, $args ) {
	// Change $ignore as needed, then return it.
	return $ignore;
}

src/domains/ordering/initializer.php:305, and 1 more place

filter

davo_orderable_post_types

Filter which REST-enabled post types get manual ordering support.

Parameters of davo_orderable_post_types
ParameterTypeDescription
$post_typesstring[]Post type slugs.
add_filter
add_filter( 'davo_orderable_post_types', 'my_filter_callback', 10, 1 );

/**
 * @param string[] $post_types
 */
function my_filter_callback( $post_types ) {
	// Change $post_types as needed, then return it.
	return $post_types;
}

src/domains/ordering/helpers.php:34

filter

davo_ordering_migration_optional_providers

Filter the providers whose objects Ordering applies order to.

Add the key of any provider that creates orderable posts or terms. Ordering-only: an order row for a post/term that never migrated is simply nothing to apply, not a data-loss risk, so this never forces one of these providers into a job that never selected it — selecting Ordering alone no longer pulls in every content domain, and Ordering itself is only pulled in by something that explicitly requires it.

Parameters of davo_ordering_migration_optional_providers
ParameterTypeDescription
$providersstring[]Provider keys.
add_filter
add_filter( 'davo_ordering_migration_optional_providers', 'my_filter_callback', 10, 1 );

/**
 * @param string[] $providers
 */
function my_filter_callback( $providers ) {
	// Change $providers as needed, then return it.
	return $providers;
}

src/domains/ordering/migration-provider.php:124

filter

davo_ordering_migration_post_types

Filter the post types whose manual order is included in an export.

Parameters of davo_ordering_migration_post_types
ParameterTypeDescription
$typesstring[]Post type slugs.
add_filter
add_filter( 'davo_ordering_migration_post_types', 'my_filter_callback', 10, 1 );

/**
 * @param string[] $types
 */
function my_filter_callback( $types ) {
	// Change $types as needed, then return it.
	return $types;
}

src/domains/ordering/migration-provider.php:386

action

davo_post_order_updated

Fires after a post's manual order changes.

Parameters of davo_post_order_updated
ParameterTypeDescription
$post_idintThe post that moved.
$new_orderintIts new menu_order.
$old_orderintIts previous menu_order.
add_action
add_action( 'davo_post_order_updated', 'my_action_callback', 10, 3 );

/**
 * @param int $post_id
 * @param int $new_order
 * @param int $old_order
 */
function my_action_callback( $post_id, $new_order, $old_order ) {
	// Your code here.
}

src/domains/ordering/services/posts.php:112

filter

davo_posts_order

Filters the sort direction appended to the manual-order clause. Empty by default. Include the leading space, for example DESC.

Parameters of davo_posts_order
ParameterTypeDescription
$directionstringThe direction to append.
$query\WP_QueryThe query.

Returns string

add_filter
add_filter( 'davo_posts_order', 'my_filter_callback', 10, 2 );

/**
 * @param string $direction
 * @param \WP_Query $query
 */
function my_filter_callback( $direction, $query ) {
	// Change $direction as needed, then return it.
	return $direction;
}

src/domains/ordering/initializer.php:273

filter

davo_posts_orderby_ignore

Filters whether manual ordering leaves a query's ORDER BY clause alone. Defaults to false.

Parameters of davo_posts_orderby_ignore
ParameterTypeDescription
$ignoreboolWhether to skip manual ordering.
$order_bystringThe query's ORDER BY clause.
$query\WP_QueryThe query.

Returns bool

add_filter
add_filter( 'davo_posts_orderby_ignore', 'my_filter_callback', 10, 3 );

/**
 * @param bool $ignore
 * @param string $order_by
 * @param \WP_Query $query
 */
function my_filter_callback( $ignore, $order_by, $query ) {
	// Change $ignore as needed, then return it.
	return $ignore;
}

src/domains/ordering/initializer.php:252

action

davo_term_order_updated

Fires after a term's manual order changes.

Parameters of davo_term_order_updated
ParameterTypeDescription
$term_idintThe term that moved.
$new_orderintIts new term_order.
$old_orderintIts previous term_order.
$taxonomystringThe term's taxonomy.
$parentintThe sibling scope (parent term ID) it moved within.
add_action
add_action( 'davo_term_order_updated', 'my_action_callback', 10, 5 );

/**
 * @param int $term_id
 * @param int $new_order
 * @param int $old_order
 * @param string $taxonomy
 * @param int $parent
 */
function my_action_callback( $term_id, $new_order, $old_order, $taxonomy, $parent ) {
	// Your code here.
}

src/domains/ordering/services/terms.php:123

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first