diff --git a/includes/forums/functions.php b/includes/forums/functions.mio.php
index 692ef51..3841446 100644
old
|
new
|
function bbp_pre_get_posts_normalize_forum_visibility( $posts_query = null ) { |
1850 | 1850 | // Get any existing meta queries |
1851 | 1851 | $meta_query = (array) $posts_query->get( 'meta_query', array() ); |
1852 | 1852 | |
| 1853 | // Don't add our meta query if we would mess up the existing query, as we shouldn't impose the presence of _bbp_forum_id meta key on the posts, for queries that aren't our own |
| 1854 | if ( array_key_exists( 'relation', $meta_query ) && $meta_query['relation'] != 'OR' ) |
| 1855 | return; |
| 1856 | |
| 1857 | // Add this condition to not mess up with non-bbPress queries, making the presence of _bbp_forum_id meta key on the posts be optional |
| 1858 | $meta_query['relation'] = 'OR'; |
| 1859 | $meta_query[] = array( |
| 1860 | 'key' => '_bbp_forum_id', |
| 1861 | 'compare' => 'NOT EXISTS', |
| 1862 | 'value' => '', |
| 1863 | ); |
| 1864 | |
1853 | 1865 | // Add our meta query to existing |
1854 | 1866 | $meta_query[] = $forum_ids; |
1855 | 1867 | |