Created
April 24, 2025 12:36
-
-
Save ipokkel/6739f283be521ac8cc704ef92d0e87f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Automatically add paragraphs for set elements displayed on the member directory. | |
* | |
* 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_pmpromd_wpautop_elements( $value, $element, $pu, $displayed_levels ) { | |
// Set the user field names that should be formatted here. | |
$autop_fields = array( 'user_field_name_one', 'user_field_name_two', 'user_field_name_three' ); | |
if ( in_array( $element, $autop_fields ) ) { | |
$value = wpautop( $value ); // add paragraphs. | |
} | |
return $value; | |
} | |
add_filter( 'pmpromd_get_display_value', 'my_pmpromd_wpautop_elements', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment