Skip to main contentSkip to footer

PublishPress Revisions causes duplicates to appear in Relevanssi search results when a revision is approved.

When the revision is created, Relevanssi indexes it because it has the same post type as the original post with the post status draft. Relevanssi indexes drafts because people may want to search for them in the admin search. This is all fine because the draft post isn’t visible in the search.

When the revision is approved, the post type changes to revision and the post status changes to inherit (and the parent has publish, so that’s what the revision inherits) Relevanssi should not index revisions; that’s why reindexing helps. However, the status change happens in a way Relevanssi doesn’t notice, so now Relevanssi sees there’s a post with publish status, and it can be shown in the search results.

Add this to your site to fix this problem:

add_action( 'revision_applied', function( $published, $revision ) {
    relevanssi_remove_doc( $revision->ID );
}, 10, 2 );

This will make Relevanssi deindex the revision when it’s approved.

Your account

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

Search

Popular Resources

Automatic redirects to category archives

…This will make sure your redirection settings are always up to date. To create the first redirects, you need to add this function to your site and then save a product category term. This does not remove redirects for non-existing categories, so that is something you need to maintain manually….

Related searches feature
John Blackbourn wrote a cool related searches feature for Relevanssi Premium. It’s included from version 1.7.4. In order to use…

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