Passing JSON Variable to PHP Function
-
Greetings fellow WP admins. I’m attempting to call a PHP function via the RestAPI and for the life of me cannot figure out how to pass a JSON variable to the following function:
function update_user_status_to_pending_from_api ( $params){
$userID = $params[‘userID’];
wp_set_object_terms( $userID, array( ‘pending’ ), ‘user_status’, false );
clean_object_term_cache( $userID, ‘user_status’ );
}I’d like to pass the UserID variable via the JSON body at the time of the rest API request, but I’m not sure how-to pass the JSON value.
Help is appreciated!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Passing JSON Variable to PHP Function’ is closed to new replies.