title: Drafts and Archived posts are showing through 'Related posts' using Anchor CMS
body: <p>I'm using Anchor CMS.</p>
  
  <p>Everything works great except posts that are labelled 'Draft' are still showing live on the site in the 'Related posts' section, yet I have no idea why as from what I can see, only published posts should show up.</p>
  
  <p>This is the code I'm using to show related posts at the bottom of each article:</p>
  
  <p>Functions.php</p>
  
  <pre><code>function related_posts($n) {
  $posts = Post::get(Base::table('posts'), '=', 'published');
  $postarr = array();
  foreach($posts as $post) :
  if($post-&gt;id != article_id()) {
      if($post-&gt;category == article_category_id()) {
          array_push($postarr, $post);
      }
  }
  endforeach;    
  shuffle($postarr);
  $postarr = array_slice($postarr, 0, $n);
  return $postarr;
  }
  
  function article_category_id() {
  if($category = Registry::prop('article', 'category')) {
  $categories = Registry::get('all_categories');
  return $categories[$category]-&gt;id;
  }
  }
  </code></pre>
  
  <p>Article.php</p>
  
  <pre><code>&lt;?php foreach( related_posts(3) as $post) : ?&gt;
  &lt;div class="similar-posts"&gt;
  &lt;div class="simi-alt"&gt;
  &lt;a href="&lt;?= $post-&gt;slug; ?&gt;"&gt;&lt;?= $post-&gt;title; ?&gt;&lt;/a&gt; 
  &lt;/div&gt;   
  &lt;p class="sim-desc"&gt;&lt;?= $post-&gt;description; ?&gt; &lt;a href="&lt;?= $post-&gt;slug; ?&gt;"&gt;Read more..&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>