Skip to content

Instantly share code, notes, and snippets.

@MaximeCulea
Created July 23, 2019 15:14
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 MaximeCulea/039242f96a2019f5bd9ad86aa4e9a723 to your computer and use it in GitHub Desktop.
Save MaximeCulea/039242f96a2019f5bd9ad86aa4e9a723 to your computer and use it in GitHub Desktop.
WP All Export tweeks
<?php
/**
* Change on the fly an ACF value
* Here group id into group name
*
* @param $value : original value
* @param $field_name : field key name
* @param $post_id : post id
*
* @author Maxime CULEA
*
* @return string
*/
public function mc_id_to_group_name( $value, $field_name, $post_id ) {
if ( ! in_array( $field_name, [ 'group_most_active', 'group_latest' ]) ) {
return $value;
}
$group = new \BP_Groups_Group( (int)$value );
return empty( $group->name ) ? $value : $group->name;
}
add_filter( 'pmxe_acf_field', 'mc_id_to_group_name', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment