[wp-trac] [WordPress Trac] #59215: Bug in wp_set_post_categories function

WordPress Trac noreply at wordpress.org
Mon Aug 28 17:10:00 UTC 2023


#59215: Bug in wp_set_post_categories function
-----------------------------------------+------------------------------
 Reporter:  faaiq                        |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Taxonomy                     |     Version:  6.3
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:
-----------------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch => has-patch reporter-feedback


Comment:

 Hi there, welcome to WordPress Trac! Thanks for the ticket.

 Looking at the PR, it does not appear to be correct (as demonstrated by
 the failing unit tests), because the third parameter of
 `wp_set_post_terms()` is the taxonomy name, not the post type. Looking
 further, the post type does not seem relevant at all, since the underlying
 `wp_set_object_terms()` does not use it, only the post ID.

 > so `wp_set_post_categories` is not working to map custom category with
 custom post type.

 1. Could you provide the steps to reproduce the issue on a clean install?
 2. `wp_set_post_categories()` is indeed specific to categories by design.
 Perhaps `wp_set_post_terms()` would work for your use case?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59215#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list