Fires after a file has been sideloaded and committed directly to a target — the sideload equivalent of 'davo_attachment_uploaded' immediately followed by a successful commit_to_target(), collapsed into one event since sideload_from_path() has no separate temporary/commit steps of its own.
Filter whether a user may upload attachments for this target type at all, independent of any specific target post.
The name is built at runtime: davo_attachments_can_upload_ followed by a suffix.
Parameters of davo_attachments_can_upload_…
Parameter
Type
Description
$can_upload
bool
Default true (no extra gate).
$user_id
int
Uploading user ID.
$target_id
int
Target post ID (0 pre-creation) — a trailing argument, added after $user_id, specifically so it's additive: a callback already registered with accepted_args = 2 is completely unaffected and never receives it.
add_filter
// $suffix is the part of the name that varies.add_filter( 'davo_attachments_can_upload_' . $suffix, 'my_filter_callback', 10, 3 );
/**
* @param bool $can_upload
* @param int $user_id
* @param int $target_id
*/functionmy_filter_callback( $can_upload, $user_id, $target_id ) {
// Change $can_upload as needed, then return it.return$can_upload;
}
Filters how many hours temporary attachments are kept after a failed commit. Defaults to 168 (seven days). A value of 0 or less leaves the expiry unchanged.
Parameters of davo_attachments_failed_commit_grace_hours
Parameter
Type
Description
$hours
int
Grace period in hours.
Returnsint
add_filter
add_filter( 'davo_attachments_failed_commit_grace_hours', 'my_filter_callback', 10, 1 );
/**
* @param int $hours
*/functionmy_filter_callback( $hours ) {
// Change $hours as needed, then return it.return$hours;
}
Filters the largest single file allowed for a target type.
The name is built at runtime: davo_attachments_max_file_size_ followed by a suffix.
Parameters of davo_attachments_max_file_size_…
Parameter
Type
Description
$max
int
Bytes; defaults to the global limit.
add_filter
// $suffix is the part of the name that varies.add_filter( 'davo_attachments_max_file_size_' . $suffix, 'my_filter_callback', 10, 1 );
/**
* @param int $max
*/functionmy_filter_callback( $max ) {
// Change $max as needed, then return it.return$max;
}
Filters the providers that must ALWAYS be imported before Attachments, widening any export that includes Attachments even when the added provider was never selected. Reserved for a genuinely hard requirement; a content domain that merely wants its posts imported first WHEN ALSO SELECTED should hook davo_attachments_migration_optional_providers instead (see optional_providers()) — that's what every current content domain uses.
Parameters of davo_attachments_migration_required_providers
Resolve permission/visibility for a single attachment target of this type. The owning domain must hook this and return the full {exists, can_edit, can_view, is_public} shape – returning the unmodified $default leaves the target treated as nonexistent.
The name is built at runtime: davo_attachments_resolve_target_ followed by a suffix.
// $suffix is the part of the name that varies.add_filter( 'davo_attachments_resolve_target_' . $suffix, 'my_filter_callback', 10, 3 );
/**
* @param array{exists: bool, can_edit: bool, can_view: bool, is_public: bool} $default
* @param int $target_id
* @param int $user_id
*/functionmy_filter_callback( $default, $target_id, $user_id ) {
// Change $default as needed, then return it.return$default;
}
src/domains/attachments/object-resolver.php:89, and 2 more places
Filter: resolve the Attachments target_type slug for a WP post type, or null if that post type has no attachments integration. Each domain that registers an attachment target type (Questions, future Articles/ Tickets, ...) hooks this once for its own post type(s).
Parameters of davo_attachments_target_type_for_post_type
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.