Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi,

    Does the scheduled posts appear in the archives? Did you use pre_get_posts to do it?

    I’ve looked into wp_dropdown_categories as well as get_terms (which is used by the former). There does not seem to be anything regarding future posts. They seem to just not be connected? I’m not sure..

    If you find a way to make wp_dropdown_categories or get_terms to include future posts terms share it here and we should be able to make it work. I might also be able to include it as a simple on/off switch filter in a future version of BTF.

    Thread Starter amurado

    (@amurado)

    Hi,

    Yes, they appear in archives. The plugin (WPMDB) that creates the CPT posts does use pre_get_posts to show them. This is what the plugin uses:

    add_filter('pre_get_posts','wpmdb_show_future_posts');
    function wpmdb_show_future_posts($query) {
    if (!is_admin()&&!is_single()) $query->set('post_status','publish,future');
    	return $query;
    }
    
    add_filter('the_posts', 'show_all_future_posts');
    function show_all_future_posts($posts) {
       global $wp_query, $wpdb;
       if(is_single() && $wp_query->post_count == 0) $posts = $wpdb->get_results($wp_query->request);
       return $posts;
    }

    I can’t seem to find anything online ?? I’ll try and ask the plugin’s author and report back.

    Thanks!

    Plugin Author Jonathandejong

    (@jonathandejong)

    Cool, that looks correct. I was just curious really since it unfortunately does not help our situation.

    Thread Starter amurado

    (@amurado)

    Hey,

    The author of my plugin replied and said the following. Let me know if it helps our situation and if you have any ideas?

    Just had a look at your discussion about this other plugin and future posts. The author is right when he says nothing in these functions is directly related to future posts, but empty terms are indirectly related: terms are considered “not empty” only if they contain published posts, so terms with only draft or scheduled posts are considered “empty”.
    So the solution may involve setting the ‘hide_empty’ parameter (true by default) to false when calling wp_dropdown_categories() (this function will then pass this argument to get_terms() ).

    Thanks!

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Amurado,

    He’s basically saying the same thing ?? To enable “show empty term”.
    I don’t think we can do anything to this (if you dont want to enable empy terms) without modifying core files which I would not recommend.

    I suppose you can always create a ticket to WordPress and describe your issue and maybe suggest a new filter with which one can modify the behavior of get_terms to allow draft/future etc. statuses to be recognized.

    Edit:
    Here’s a link to do that https://core.trac.www.ads-software.com/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show Terms/Categories From Scheduled Posts’ is closed to new replies.