• We’re using PublishPress Revisions to manage revisions on our website and found that each time we accepted a revision, a duplicate of the post would show up in search. To fix it, we had to?“Build the index.”

    https://imgur.com/a/obLNzVy

    Is there any way to avoid having these “revised” posts show up in searches since they don’t actually exist? The post title would show up, taking up a spot in search, but would then go to a 404 page.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    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.

    Thread Starter Crystal Torres-Martinez

    (@crystaltm)

    @msaari Thank you for the explanation and fix! We went ahead and added the snippet to test with the next revisions. I’m sure it’ll work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Possible Issue with PublishPress Revisions Posts’ is closed to new replies.