• Resolved sbckmstr

    (@sbckmstr)


    I am having a problem on the Portfolio page of my site where custom posts with the status ‘Draft’ are showing up in the post list.

    I don’t know when this started exactly, but draft posts were previously hidden from this list.

    My WP_Query looks like this:

    $loop = new WP_Query(array('post_type' => 'project', 'posts_per_page' => -1, 'meta_key' => 'hide_in_portfolio', 'meta_value' => 'No'));
    if ( $loop ) :
    while ( $loop->have_posts() ) : $loop->the_post();

    I currently have one draft post that has never been published, while it is a draft it shows up in this list, if i trash it then it doesn’t. The post also doesn’t show up in search while it has ‘draft’ status (normal behaviour).

    Any ideas? Is there an issue with 4.1.1?

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • kmessinger

    (@kmessinger)

    What theme and what url?

    Thread Starter sbckmstr

    (@sbckmstr)

    I figured it out.

    I have my portfolio page set to filter using AJAX and it would appear that when calling WP_Query from functions.php ‘post_status’ => ‘publish’ is not implicit.

    Added this argument and now all is fine!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Draft custom post types visible to public?’ is closed to new replies.