Skip to content

Drop empty counts in prompress_posts_total.#15

Open
gassan wants to merge 1 commit intoPeterBooker:mainfrom
TeDo-Verlag:drop-empty-counts-post-statuses
Open

Drop empty counts in prompress_posts_total.#15
gassan wants to merge 1 commit intoPeterBooker:mainfrom
TeDo-Verlag:drop-empty-counts-post-statuses

Conversation

@gassan
Copy link
Copy Markdown
Contributor

@gassan gassan commented Nov 9, 2025

On. installations with many posts_statuses and/or post_types we have too many zero values.
Do we need them?

@PeterBooker
Copy link
Copy Markdown
Owner

I am hesitant to automatically remove them, as potentially a zero value is useful data (albeit unlikely).

We could make it a filter, allowing sites to declare that they do not want zero values?

Something like:

$drop_zero = \apply_filters(
    'prompress_posts_drop_zero_counts',
    true,
    $post_type,
    $status,
    (int) $count
);

if ( $drop_zero && ! $count ) {
    continue;
}

@gassan
Copy link
Copy Markdown
Contributor Author

gassan commented Nov 25, 2025

I’ll add this filter in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants