Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created March 13, 2023 10:54
Show Gist options
  • Save ipokkel/4f5db2ec2b039dbb2ccdb6d9afe2e2a7 to your computer and use it in GitHub Desktop.
Save ipokkel/4f5db2ec2b039dbb2ccdb6d9afe2e2a7 to your computer and use it in GitHub Desktop.
<?php
/**
* Example of how to set an alt tag for Basic User Avatars when the
* alt tag is not set.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_basic_user_avatar_alt_tag( $arguments ) {
if ( empty( $arguments['alt'] ) ) {
$arguments['alt'] = 'User avatar';
}
return $arguments;
}
add_filter( 'basic_user_avatar_data', 'my_basic_user_avatar_alt_tag', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment