Skip to content

Actions and filters

Sharing: 3 hooks.

Every hook here has a description in the source.

0 actions3 filters

filter

davo_share_networks

Filters the networks offered by the share dialog.

Parameters of davo_share_networks
ParameterTypeDescription
$networksstring[]Network slugs in display order.
add_filter
add_filter( 'davo_share_networks', 'my_filter_callback', 10, 1 );

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

src/domains/sharing/helpers.php:58

filter

davo_sharing_payload

Filters a share payload before it is returned.

Parameters of davo_sharing_payload
ParameterTypeDescription
$payloadarray<string, mixed>Normalised payload.
$typestringTarget type.
$idintTarget ID.
add_filter
add_filter( 'davo_sharing_payload', 'my_filter_callback', 10, 3 );

/**
 * @param array<string, mixed> $payload
 * @param string $type
 * @param int $id
 */
function my_filter_callback( $payload, $type, $id ) {
	// Change $payload as needed, then return it.
	return $payload;
}

src/domains/sharing/repository.php:81

filter

davo_sharing_resolve_{suffix}

Lets the domain that owns a target type resolve it.

Return null to decline, a WP_Error when the target exists but is not shareable, or an array with url, title and optionally kind, kind_label, excerpt and image. Resolve as a signed-out visitor.

The name is built at runtime: davo_sharing_resolve_ followed by a suffix.

Parameters of davo_sharing_resolve_…
ParameterTypeDescription
$resolvedarray<string, mixed>|WP_Error|nullResolution so far, null when none.
$idintTarget ID.
add_filter
// $suffix is the part of the name that varies.
add_filter( 'davo_sharing_resolve_' . $suffix, 'my_filter_callback', 10, 2 );

/**
 * @param array<string, mixed>|WP_Error|null $resolved
 * @param int $id
 */
function my_filter_callback( $resolved, $id ) {
	// Change $resolved as needed, then return it.
	return $resolved;
}

src/domains/sharing/repository.php:58

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