Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using EditFlow's "custom status" feature for an event calendar plugin I am writing for a client.

I've created a status called "previous events", when a date has happened the events post_status goes from "publish" to "previous events", as they would like to display previous events.

The issue I am facing is that the ALL posts that have post_status in WordPress set to anything other then "Public" don't get shown to people are not logged in when people click on the permalink for that particular post.

Does anyone know of a way around this? A hack maybe in WordPress?

share|improve this question
add comment

1 Answer

I have been looking to do something like that with EditFlow, where a custom status will determine if the post shows up on the homepage via a get_posts() query.

$promoted_posts = get_posts( array( 'post_status' => 'promoted' ) );

That works, but it looks like I'll need to filter the WP Query on the single page so that it respects the 'promoted' status as well as 'publish' status (thus preventing the 404 for promoted posts). Likely in 'pre_get_posts' hook to update 'post_status' to include 'promoted' status. Something like:

add_action( 'pre_get_posts', function( WP_Query $query ){ 
    $query->init();
    $query->parse_query( 'post_status=publish,promoted&...' );
    return $query;
});

That's not exact code - but hopefully gets the idea across.

As a caveat, I'll point out that doing this seem against the spirit of EditFlow's custom statuses - they seem to be more about the status of a post prior to publishing - at least the examples hint at that ('pitch','needs edit','ready to publish', etc.) and the Publish button still looms on the edit screen, ready to change status to 'publish' at a click. So it feels like this is against the direction of development and practice for EditFlow.

I can achieve the same thing above with a custom taxonomy instead, or possibly using a post meta value. Certainly authors like the idea of toggling the 'status' of the post in order to give it a 'privileged status' - I don't like the idea of filtering every main loop query to include all 'publishable' custom statuses.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.