Created
March 13, 2023 10:54
-
-
Save ipokkel/4f5db2ec2b039dbb2ccdb6d9afe2e2a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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