Last active
August 9, 2022 19:23
-
-
Save joshuadavidnelson/33e1948e08fdc42f758ed3b8c083c639 to your computer and use it in GitHub Desktop.
Filter the MultilingualPess admin metabox to allow for connecting translations to other post types on remote site.
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 | |
/** | |
* Filter the post search arguments allow for cross-post-type connections. | |
* | |
* @param array $args the WP_Query arguments used. | |
* @return array | |
*/ | |
function remote_post_search_arguments( $args ) { | |
$translated_post_types = array( 'post', 'page', 'product' ); | |
if ( isset( $args['post_type'] ) | |
&& is_string( $args['post_type'] ) | |
&& in_array( $args['post_type'], $translated_post_types, true ) ) { | |
$args['post_type'] = $translated_post_types; | |
} | |
return $args; | |
} | |
add_filter( 'multilingualpress.remote_post_search_arguments', 'jdn_remote_post_search_arguments', 100, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment