WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
[resolved] Admin Search - No results returned for private posts (5 posts)

  1. kevin98lude
    Member
    Posted 7 months ago #

    I'm having an issue with the admin search feature. I have a post type called vehicles. When I search, for example using a stock number, any vehicle set to 'private' does not show up. Any 'public' vehicles show as expected. Is there a way to allow private posts results in the admin.

    http://wordpress.org/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 7 months ago #

    What is the capability type of your custom post type? Relevanssi is assuming the capability is "read_private_POSTTYPEs", which is causing the problems here.

    If you want a quick fix, edit lib/common.php in Relevanssi. Find this bit of code:

    if (in_array($status, array('draft', 'pending', 'future')) && is_admin()) {
    		$post_ok = true;
    }

    and change it to:

    if (in_array($status, array('draft', 'pending', 'future', 'private')) && is_admin()) {
    		$post_ok = true;
    }

    For the next version, I'll come up with something more robust here.

  3. Mikko Saari
    Member
    Plugin Author

    Posted 7 months ago #

    Actually, forget that. Here's a new version of common.php that should fix the problem. Please try replacing your current lib/common.php with this file and let me know if that helps:

    https://dl.dropboxusercontent.com/u/9585896/common.php

  4. kevin98lude
    Member
    Posted 7 months ago #

    Thank you.

    The new common.php file worked after removing the . 's' from the line: $cap = 'read_private_' . $type it

    The .'s' would have worked if I wouldn't have changed the post type name from vehicle to vehicles sometime ago.

  5. Mikko Saari
    Member
    Plugin Author

    Posted 7 months ago #

    Thanks.

Reply

You must log in to post.

About this Plugin

About this Topic