Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • torarnv
    Member

    Technically, a transient can also expire before the timeout, at any time, so the form validation may fail regardless of caching, say if the user spends a bit of time filling out the form.

    in reply to: Taxonomies, custom post statuses, and wp_tag_cloud() #7437
    torarnv
    Member

    Apologies, should be:

    // Ensure that custom post statues are also included in taxonomy counts
    function update_foo_term_count($terms, $taxonomy) {
    	$include_all_statuses = function($sql) {
    		return str_replace("post_status = 'publish'",
    			"post_status NOT IN ('inherit','auto-draft','trash')", $sql);
    	};
    	add_filter('query', $include_all_statuses);
    	_update_post_term_count($terms, $taxonomy);
    	remove_filter('query', $include_all_statuses);
    }
    
    in reply to: Taxonomies, custom post statuses, and wp_tag_cloud() #7436
    torarnv
    Member

    Here’s a minimal trick to include the custom post statues in the count:

    // Ensure that custom post statues are also included in taxonomy counts
    function update_registration_term_count($terms, $taxonomy) {
    	function include_all_statuses($sql) {
    		return str_replace("post_status = 'publish'",
    			"post_status NOT IN ('inherit','auto-draft','trash')", $sql);
    	}
    	add_filter('query', 'include_all_statuses');
    	_update_post_term_count($terms, $taxonomy);
    	remove_filter('query', 'include_all_statuses');
    }
Viewing 3 posts - 1 through 3 (of 3 total)