WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] posts_where filters

[Resolved] posts_where filters

  • Can anyone give me a tip on how to correctly add additional statuses to this statement (i.e. ‘trash’, ‘draft’, etc.):

    function search_site_where ($where = '') {
    
    	global $wpdb;
    
    	return $where .= " AND {$wpdb->posts}.post_status != 'private' ";
    }

    I’m adding to a pre_get_posts $query.

    I’ve tried setting a variable with array and for each statement, neither seems to work.

    Any ideas?

Viewing 1 replies (of 1 total)
  • Firgured out on my own:

    return $where .= " AND {$wpdb->posts}.post_status != 'private' AND {$wpdb->posts}.post_status != 'trash' ";

    Hope it helps someone else.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] posts_where filters’ is closed to new replies.