There is a function in parent theme and I want to customize success message, I don't want to make change in parent theme file. And the function is not pluggable so I can't override it. After digging, I found that I can use add_filter
hook to filter response.
I wrote this code:
add_filter( 'wp_ajax_sync-data', 'custom_sync_data' );
function custom_sync_data(){
$response = array(
'success' => true,
'message' => 'Date is updated'
);
wp_send_json($response);
}
It does the job but it always returns success
message, without any validation. I don't know, how to pass parameter for validation or decision making.
Can you try this
You may also use
var_dump($params)
to check if anything is passed to function.Hope this helps.