Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Last active January 22, 2021 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/a93ff16c650667172924102873004a32 to your computer and use it in GitHub Desktop.
Save ipokkel/a93ff16c650667172924102873004a32 to your computer and use it in GitHub Desktop.
This recipe adds a custom to the [pmpro_member] shortcode.
<?php
/**
* This recipe adds a custom to the [pmpro_member] shortcode.
*
* 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_pmpro_member_shortcode_custom_field_1611286235606( $r, $user_id, $field ) {
if ( 'user_id' === $field || 'ID' === $field || 'member_id' === $field ) {
$r = $user_id;
}
return $r;
}
add_filter( 'pmpro_member_shortcode_field', 'my_pmpro_member_shortcode_custom_field_1611286235606', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment