Avatar Privacy 2.7.0 has 2 actions and 32 filters, read directly from its source code on Nov 18, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when Avatar Privacy fires an action
add_action( 'avatar_privacy_uninstallation_site', function( $site_id ) {
// Your code runs here.
}, 10, 1 );
// Change a value Avatar Privacy is about to use
add_filter( 'avatar_privacy_gravatar_link_rel', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * This action is documented in class-uninstallation.php */ do_action( 'avatar_privacy_uninstallation_site', $site_id ); -
/** * Filters the `rel` attribute for user-visible links to gravatar.com. */ apply_filters( 'avatar_privacy_gravatar_link_rel', 'noopener nofollow' ); -
/** * Filters the `target` attribute for user-visible links to gravatar.com. */ apply_filters( 'avatar_privacy_gravatar_link_target', '_self' ); -
/** * This filter is documented in * avatar-privacy/components/class-avatar-handling.php */ apply_filters( 'avatar_privacy_legacy_icon_url', $url, $hash, $size, [ 'force' => $args['force'] ] ); -
/** * This action is documented in class-uninstallation.php */ do_action( 'avatar_privacy_uninstallation_global' ); -
/** * Filters how often the clean-up cron job for old images should run. */ apply_filters( 'avatar_privacy_all_images_cleanup_interval', 7 * \DAY_IN_SECONDS ); -
/** * Filters how long cached images are kept. */ apply_filters( 'avatar_privacy_all_images_max_age', 7 * \DAY_IN_SECONDS ); -
/** * Filters whether remote default icon URLs (i.e. having a different domain) * are allowed. */ apply_filters( "avatar_privacy_allow_remote_{$context}_url", false ); -
/** * Filters whether `style="display:inline;"` should be added to the label of * the `use_gravatar` checkbox in the comments form. */ apply_filters( 'avatar_privacy_comment_checkbox_disable_inline_style', false ); -
/** * Filters the default icon URL for the given e-mail. */ apply_filters( 'avatar_privacy_default_icon_url', \includes_url( 'images/blank.gif' ), $hash, $size, $args ); -
/** * Filters whether a global table should be enabled for multisite * installations. */ apply_filters( 'avatar_privacy_enable_global_table', $global_table ); -
/** * Filters whether we check if opting-in users and commenters actually have a * Gravatar.com account. */ apply_filters( 'avatar_privacy_enable_gravatar_check', true, $email, $user_id ); -
/** * Filters whether to enqueue the script. */ apply_filters( "avatar_privacy_enqueue_script_{$key}", true ); -
/** * Filters whether to enqueue the stylesheet. */ apply_filters( "avatar_privacy_enqueue_style_{$key}", true ); -
/** * Filters the Gravatar.com URL for the given e-mail. */ apply_filters( 'avatar_privacy_gravatar_icon_url', '', $hash, $size, $args ); -
/** * Filters the default policy for showing gravatars. */ apply_filters( 'avatar_privacy_gravatar_use_default', false, $id_or_email ); -
/** * Filters how often the clean-up cron job for old gravatar images should run. */ apply_filters( 'avatar_privacy_gravatars_cleanup_interval', \DAY_IN_SECONDS ); -
/** * Filters how long cached gravatar images are kept. */ apply_filters( 'avatar_privacy_gravatars_max_age', 2 * \DAY_IN_SECONDS ); -
/** * Filters the parsed user ID, email address and "object age". */ apply_filters( 'avatar_privacy_parse_id_or_email', [ $user_id, $email, $age ], $id_or_email ); -
/** * Filters the priority used for filtering the `pre_get_avatar_data` hook. */ apply_filters( 'avatar_privacy_pre_get_avatar_data_filter_priority', 9999 ); -
/** * Filters whether to retrieve the user avatar early. If the filtered result * contains both a filename and a MIME type, those will be returned * immediately. */ apply_filters( 'avatar_privacy_pre_get_user_avatar', null, $user_id ); -
/** * Filters whether native profile picture uploading is disabled for some * reasone (e.g. because another plugin already provides for that). */ apply_filters( 'avatar_privacy_profile_picture_upload_disabled', false ); -
/** * Filters the salt used for generating this sites email hashes. */ apply_filters( 'avatar_privacy_salt', '' ); -
/** * Filters the maximum height for uploaded images. */ apply_filters( 'avatar_privacy_upload_max_height', 2000 ); -
/** * Filters the maximum width for uploaded images. */ apply_filters( 'avatar_privacy_upload_max_width', 2000 ); -
/** * Filters the minimum height for uploaded images. */ apply_filters( 'avatar_privacy_upload_min_height', 0 ); -
/** * Filters the minimum width for uploaded images. */ apply_filters( 'avatar_privacy_upload_min_width', 0 ); -
/** * Filters the insert position for the `use_gravatar` checkbox. */ apply_filters( 'avatar_privacy_use_gravatar_position', $this->get_position( $fields ) ); -
/** * Filters the uploaded avatar URL for the given user. */ apply_filters( 'avatar_privacy_user_avatar_icon_url', '', $hash, $size, $args ); -
/** * Filters the result of checking whether the candidate URL is a valid image * URL. */ apply_filters( "avatar_privacy_validate_{$context}_url", $result, $maybe_url, $allow_remote ); -
/** * Filters the interval between gravatar validation checks. */ apply_filters( 'avatar_privacy_validate_gravatar_interval', $duration, ! empty( $result ), $age ); -
/** * This filter is documented in wp-includes/comment.php */ apply_filters( 'comment_cookie_lifetime', 30000000 ); -
/** * This filter is documented in wp-includes/pluggable.php */ apply_filters( 'get_avatar_comment_types', [ 'comment' ] ); -
/** * This filter is documented in wp-includes/functions.php */ apply_filters( 'wp_delete_file', $file );
Generated from Avatar Privacy's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: