Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dgoze/1ef9547fa9053871e96a0ee435e5f8a1 to your computer and use it in GitHub Desktop.
Save dgoze/1ef9547fa9053871e96a0ee435e5f8a1 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.
<?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