{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/zoninator/issues/35","labels_url":"https://api.github.com/repos/Automattic/zoninator/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/zoninator/issues/35/comments","events_url":"https://api.github.com/repos/Automattic/zoninator/issues/35/events","html_url":"https://github.com/Automattic/zoninator/issues/35","id":88296141,"number":35,"title":"Duplicate WP_Queries in get_zone_posts","user":{"login":"jessedyck","id":3139690,"avatar_url":"https://avatars.githubusercontent.com/u/3139690?v=3","gravatar_id":"","url":"https://api.github.com/users/jessedyck","html_url":"https://github.com/jessedyck","followers_url":"https://api.github.com/users/jessedyck/followers","following_url":"https://api.github.com/users/jessedyck/following{/other_user}","gists_url":"https://api.github.com/users/jessedyck/gists{/gist_id}","starred_url":"https://api.github.com/users/jessedyck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessedyck/subscriptions","organizations_url":"https://api.github.com/users/jessedyck/orgs","repos_url":"https://api.github.com/users/jessedyck/repos","events_url":"https://api.github.com/users/jessedyck/events{/privacy}","received_events_url":"https://api.github.com/users/jessedyck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-15T02:47:23Z","updated_at":"2015-06-15T22:53:37Z","closed_at":null,"body":"I'm trying to perform some actions on each query being executed on a page, using the pre_get_posts action. I'm finding that zoninator loops are executing the query twice for each loop when I use z_get_posts_in_zone to get a list of arrays. \r\n\r\nThe first one is in [zoninator.php on line 1012](https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1012). get_zone_posts() runs get_zone_query() which returns a new WP_Query back to get_zone_posts. https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1056\r\n\r\nThe second is when get_posts is called on that query on line 1013 [here](https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1013). get_posts() also also creates a new WP_Query as you can see [here](https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/post.php#L1876).\r\n\r\nI couldn't find anything to support this being the desired effect, and I can't think of a scenario in this case where running 2 queries would be needed. "},"comment":{"url":"https://api.github.com/repos/Automattic/zoninator/issues/comments/112232566","html_url":"https://github.com/Automattic/zoninator/issues/35#issuecomment-112232566","issue_url":"https://api.github.com/repos/Automattic/zoninator/issues/35","id":112232566,"user":{"login":"mjangda","id":86105,"avatar_url":"https://avatars.githubusercontent.com/u/86105?v=3","gravatar_id":"","url":"https://api.github.com/users/mjangda","html_url":"https://github.com/mjangda","followers_url":"https://api.github.com/users/mjangda/followers","following_url":"https://api.github.com/users/mjangda/following{/other_user}","gists_url":"https://api.github.com/users/mjangda/gists{/gist_id}","starred_url":"https://api.github.com/users/mjangda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjangda/subscriptions","organizations_url":"https://api.github.com/users/mjangda/orgs","repos_url":"https://api.github.com/users/mjangda/repos","events_url":"https://api.github.com/users/mjangda/events{/privacy}","received_events_url":"https://api.github.com/users/mjangda/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T22:53:36Z","updated_at":"2015-06-15T22:53:36Z","body":"Yeah, that's a bit silly :) Want to send over a PR to fix that? We can just\naccess the `posts` property for `WP_Query` instead of the `get_posts()`\ncall.\n On Jun 14, 2015 10:47 PM, \"Jesse Dyck\" <notifications@github.com> wrote:\n\n> I'm trying to perform some actions on each query being executed on a page,\n> using the pre_get_posts action. I'm finding that zoninator loops are\n> executing the query twice for each loop when I use z_get_posts_in_zone to\n> get a list of arrays.\n>\n> The first one is in zoninator.php on line 1012\n> <https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1012>.\n> get_zone_posts() runs get_zone_query() which returns a new WP_Query back to\n> get_zone_posts.\n> https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1056\n>\n> The second is when get_posts is called on that query on line 1013 here\n> <https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1013>.\n> get_posts() also also creates a new WP_Query as you can see here\n> <https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-includes/post.php#L1876>\n> .\n>\n> I couldn't find anything to support this being the desired effect, and I\n> can't think of a scenario in this case where running 2 queries would be\n> needed.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/Automattic/zoninator/issues/35>.\n>\n"}}