Forked from joshuadavidnelson/multilingualpress-cross-post-type.php
Created
May 2, 2025 23:43
-
-
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.
This file contains hidden or 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