[wp-trac] [WordPress Trac] #38843: Add filter for post statuses in _update_post_term_count()
WordPress Trac
noreply at wordpress.org
Sun Jan 24 14:55:06 UTC 2021
#38843: Add filter for post statuses in _update_post_term_count()
-------------------------------------------------+-------------------------
Reporter: GunGeekATX | Owner:
| adamsilverstein
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.7
Component: Taxonomy | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note commit |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):
* keywords: has-patch has-unit-tests needs-dev-note => has-patch has-unit-
tests needs-dev-note commit
Comment:
Attached gif shows the changes work. Here's the hooked callback I used in
a must-use file:
{{{#!php
<?php
add_filter(
'update_post_term_count_statuses',
function ( $statuses, $taxonomy ) {
if ( 'category' === $taxonomy->name ) {
return array( 'future' );
$statuses[] = 'draft';
$statuses[] = 'future';
$statuses[] = 'pending';
}
return $statuses;
},
10,
2
);
}}}
Marking this ticket ready as a `commit` candidate.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38843#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list