{"action":"opened","issue":{"url":"https://api.github.com/repos/boonebgorges/buddypress-docs/issues/475","labels_url":"https://api.github.com/repos/boonebgorges/buddypress-docs/issues/475/labels{/name}","comments_url":"https://api.github.com/repos/boonebgorges/buddypress-docs/issues/475/comments","events_url":"https://api.github.com/repos/boonebgorges/buddypress-docs/issues/475/events","html_url":"https://github.com/boonebgorges/buddypress-docs/issues/475","id":97725062,"number":475,"title":"Improve memory usage in docs access protection.","user":{"login":"dcavins","id":1391994,"avatar_url":"https://avatars.githubusercontent.com/u/1391994?v=3","gravatar_id":"","url":"https://api.github.com/users/dcavins","html_url":"https://github.com/dcavins","followers_url":"https://api.github.com/users/dcavins/followers","following_url":"https://api.github.com/users/dcavins/following{/other_user}","gists_url":"https://api.github.com/users/dcavins/gists{/gist_id}","starred_url":"https://api.github.com/users/dcavins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcavins/subscriptions","organizations_url":"https://api.github.com/users/dcavins/orgs","repos_url":"https://api.github.com/users/dcavins/repos","events_url":"https://api.github.com/users/dcavins/events{/privacy}","received_events_url":"https://api.github.com/users/dcavins/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-28T14:49:05Z","updated_at":"2015-07-28T14:49:05Z","closed_at":null,"body":"Hi Boone-\r\n\r\nI've been doing some optimizations and have been thinking about `BP_Docs_Access_Query->get_doc_ids()` that finds all the docs that the user shouldn't see in order to exclude them from the main query. In order to find the forbidden fruit IDs for logged-out users, the function uses `get_posts()` then `wp_list_pluck()`. I thought I'd try using `WP_Query` directly (in order to have access to the `fields` argument). Memory usage has improved significantly on my testing site--a 40% improvement.\r\n\r\nI know there are some caveats with using `WP_Query`, so I'd appreciate your feedback on this, to make sure I'm not walking into a morass. I did mimic the way that `get_posts()` uses `WP_Query` to minimize the change. Although I don't really get the subtleties between the following:\r\n```php\r\n$var = new WP_Query( $args );\r\n```\r\nand \r\n\r\n```php\r\n$wpq = new WP_Query();\r\n$var = $wpq->query( $args );\r\n``` \r\nIf you can explain, I'd love to know.\r\n\r\nSee https://github.com/dcavins/buddypress-docs/commit/adf8487025256c8c9e4735a91874b164fc7f3000\r\n\r\nThanks!\r\n\r\n-David"}}