2

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?

3

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.

  • I ended up using a custom tax term for this, as that device was useful for marking the post in other ways (such as toggling display of featured image on a per-post basis.) – Natebot Jun 22 '16 at 17:52
0

I know this is old, but I've been searching all over ther internet for an answer and I was almost about to go for a solution where I would use custom fields etc... resuming, it would be a huge headache!

So the solution I found was simple! I am using EditFlow as well and it seems that their custom statuses, for some reason, are not public and they do not even have one simple option to make it public (which makes no sense whatsoever).

I went here https://codex.wordpress.org/Function_Reference/register_post_status and noticed that there's the public => true option...

And that's it! :)

Added it to my functions, customized it with my custom status slug and it's public, available for every non-logged-in users! :D

Thank me later. ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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