Last active
July 22, 2022 19:05
-
-
Save InpsydeNiklas/e8e22e093cd8aec79d6e7284e6a7acc5 to your computer and use it in GitHub Desktop.
MultilingualPress copy post meta GTIN field from Product Feed PRO ELITE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('multilingualpress.metabox_after_relate_posts', function($context, $request) { | |
// get post meta value from source site | |
$ProductFeedELITEGtinValue = (string)$request->bodyValue( | |
'_woosea_gtin', | |
INPUT_POST, | |
FILTER_SANITIZE_STRING | |
); | |
// switch to remote sites and save post meta | |
$remoteSiteId = $context->remoteSiteId(); | |
$remotePostId = $context->remotePostId(); | |
switch_to_blog($remoteSiteId); | |
update_post_meta($remotePostId, '_woosea_gtin', $ProductFeedELITEGtinValue); | |
restore_current_blog(); | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment