[wp-trac] [WordPress Trac] #12960: Number of posts on the Users page should include drafts and pending review
WordPress Trac
noreply at wordpress.org
Tue Jun 24 16:24:51 UTC 2025
#12960: Number of posts on the Users page should include drafts and pending review
----------------------------------------------------+---------------------
Reporter: archon810 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Users | Version: 2.9.2
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests 2nd-opinion | Focuses:
----------------------------------------------------+---------------------
Changes (by SirLouen):
* keywords: has-patch needs-testing => has-patch needs-unit-tests 2nd-
opinion
Comment:
Replying to [comment:10 donmhico]:
> Thanks for the ticket @archon810. Yeah it's 10 years old now! Hopefully
this could gain traction soon.
>
> While @Nikschavan patch works (thanks for the patch!), I don't think
directly changing the SQL inside `get_posts_by_author_sql()` is the best
approach since it could lead to unwanted changes to any plugins / themes
that uses the function.
>
> In my latest patch,
[https://core.trac.wordpress.org/attachment/ticket/12960/12960.3.diff
12960.3.diff], I introduced a new parameter `$include_unpublished` which
if set to `true` would add the SQL that will include `pending`, `future`,
and `draft` posts.
Why not just add a filter to include unpublished? (`2nd-opinion`)
Furthermore, some units test in `tests/phpunit/tests/user.php` with
whatever decision is taken, could be adequate.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12960#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list