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

bbPress: Private Groups support

Private Groups is a plugin that makes bbPress forum groups private. Relevanssi, however, doesn’t understand that privacy and will show those groups in the search results. Relevanssi has means to support this, however, with the help of the relevanssi_post_ok filter. Here’s some code from Mark Wass that makes the private…

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