Skip to main contentSkip to footer

Polylang Pro has a feature to sync translations between posts. The problem with this and Relevanssi is that Relevanssi does not index the changes to the synced posts. With this filter function added to your site, Relevanssi will also index the synced posts:

add_action( 'save_post', 'index_post_in_all_languages' );
function index_post_in_all_languages( $post_id ) {
    if ( ! function_exists( 'pll_languages_list' ) ||
     ! function_exists( 'relevanssi_insert_edit' ) ) {
        return;
    }
    $all_languages      = pll_languages_list( ['fields' => 'slug'] );
    $post_language      = pll_get_post_language( $post_id, 'slug' );
    $languages_to_index = array_diff( $all_languages, [ $post_language] );
    foreach ( $languages_to_index as $lang ) {
        $post_id_to_index = pll_get_post( $post_id, $lang );
        if ( $post_id_to_index > 0 ) {
            relevanssi_insert_edit( $post_id_to_index );
        }
    }
}

Thanks to Nico von Niederhäusern / Cubetech.

There’s also a method for indexing WPML synced posts.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Effect of Relevanssi on page speed

…So, if having a big Relevanssi table slows down the site, the effect should definitely be visible on this site. I ran three tests using a speed test tool provided by my hosting provider Seravo (one of the best WP hosting companies in the world, by the way). It’s basically……accessed at all except during searching, so it shouldn’t matter how big the table is. Fortunately site speed is something that can be measured, so we can make some actual experiments here. The experiment I used Kirjavinkit as the testing ground, because it’s one of the biggest sites I run….

Can Relevanssi access content outside WordPress?

…and so on. Those functions cannot access anything outside the WordPress installation, whether it’s another WordPress installation, HTML files or external databases. If you still need this… If you really must have Relevanssi access outside data, there’s one way to achieve that: import the data inside your WordPress installation. Create…Short answer: no. Relevanssi can only access WordPress content. For a longer answer, read on. Only within single WP installation Relevanssi only operates within one WordPress installation. Relevanssi Premium supports multisite searching, where the search can return posts from more than one subsite at once, but even in those cases……the WordPress sites must be part of the same installation. It’s not possible to search content that exists in another WordPress installation, not even if it’s on the same server. No outside content Relevanssi is heavily dependent on WordPress methods. When getting posts, Relevanssi uses the get_post() function in WordPress…

Related Posts:

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed