{"action":"opened","issue":{"url":"https://api.github.com/repos/woothemes/sensei/issues/936","labels_url":"https://api.github.com/repos/woothemes/sensei/issues/936/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/sensei/issues/936/comments","events_url":"https://api.github.com/repos/woothemes/sensei/issues/936/events","html_url":"https://github.com/woothemes/sensei/issues/936","id":86385151,"number":936,"title":"post_types query filter issue","user":{"login":"danieldudzic","id":905781,"avatar_url":"https://avatars.githubusercontent.com/u/905781?v=3","gravatar_id":"","url":"https://api.github.com/users/danieldudzic","html_url":"https://github.com/danieldudzic","followers_url":"https://api.github.com/users/danieldudzic/followers","following_url":"https://api.github.com/users/danieldudzic/following{/other_user}","gists_url":"https://api.github.com/users/danieldudzic/gists{/gist_id}","starred_url":"https://api.github.com/users/danieldudzic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danieldudzic/subscriptions","organizations_url":"https://api.github.com/users/danieldudzic/orgs","repos_url":"https://api.github.com/users/danieldudzic/repos","events_url":"https://api.github.com/users/danieldudzic/events{/privacy}","received_events_url":"https://api.github.com/users/danieldudzic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-09T00:30:52Z","updated_at":"2015-06-09T00:30:52Z","closed_at":null,"body":"> I have an existing site, added Sensei yesterday, started getting reports that certain pages did not contain information.\r\n\r\n> Specifically, this was a page that matched Custom Post Type authors to the current logged-in user.\r\n\r\n> Disabling Sensei restored functionality. After significant troubleshooting, i noted that my queries on that > page were different with and without Sensei enabled. I found the offending code here:\r\n\r\n> class-sensei-teacher.php\r\n\r\n> /**\r\n> * It ensures that the author archive shows course by the current user.\r\n> *\r\n> * This function is hooked into the pre_get_posts filter\r\n> *\r\n> * @param WP_Query $query\r\n> * @return WP_Query $query\r\n> */\r\n> public function add_courses_to_author_archive( $query ) {\r\n> if ( is_admin() || ! $query->is_author() ){\r\n> return $query;\r\n> }\r\n\r\n> $post_types= array( 'post','course' );\r\n> $query->set( 'post_type', $post_types );\r\n\r\n> return $query;\r\n> }\r\n\r\n> Note that this function overrides the post_types - no matter what they were previously. In my case, my > query was looking for custom post type \"maker\" and instead is changed to \"post\" and \"course\".\r\n\r\n> Disabling this function causes my site to return to normal.\r\n\r\n> For now, I'll override this function on my end, as I don't need it, but I'd suggest that this could be implemented in such a way to not interfere with other queries.\r\n\r\n_Link to the ticket: https://woothemes.zendesk.com/agent/tickets/301711_\r\n\r\ncc: @dwainm "}}