<?php
/*
* Manually update the upt_user post when a specific usermeta field is updated.
* @keywords EDD Front End Submission
*/
add_action( 'updated_user_meta', function( $meta_id, $object_id, $meta_key, $_meta_value ) {
// Only run for "profile_active" field
if( $meta_key == 'profile_active' ) {
// Get post ID and manually update meta
$postid = get_user_meta( $object_id, '_upt_post_id', TRUE );
update_post_meta( $postid, 'meta-profile_active', $_meta_value );
// Run FacetWP Indexer
FWP()->indexer->index( $postid );
}
}, 10, 4 );