[wp-trac] [WordPress Trac] #30999: Inconsistent parameters for edited_term_taxonomy action

WordPress Trac noreply at wordpress.org
Thu Feb 12 11:29:43 UTC 2015


#30999: Inconsistent parameters for edited_term_taxonomy action
-------------------------------------------------+-------------------------
 Reporter:  ipm-frommen                          |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Taxonomy                             |  Review
 Severity:  normal                               |     Version:  3.0
 Keywords:  needs-patch dev-feedback needs-      |  Resolution:
  unit-tests                                     |     Focuses:
-------------------------------------------------+-------------------------

Comment (by ipm-frommen):

 Replying to [comment:4 boonebgorges]:
 > I'm not currently near my computer that has a checkout of the full
 plugin repo, but having a look at the repo would be a good next step. If
 it turns out that, say, the vast majority of plugins are expecting the
 taxonomy object, it'd make it easier to decide how to solve this problem.

 Did you have a look at the full plugin repo? What does the vast majority
 of the plugins hooking to the `edited_term_taxonomy` action expect?

 ----

 Replying to [comment:5 toscho]:
 > We could limit the damage if we would turn the `$taxonomy` object into a
 real data type, i.e. a class `WP_Taxonomy`, with a `__toString()` method.

 I really like the idea (not just for taxonomies, BTW). This would, of
 course, be a substantial change and goes beyond the scope of this ticket.
 But anyway, we could start by using the new class only in the three
 functions related to this issue. This would be a minimal change as this,
 right?

 {{{
 class WP_Taxonomy {

     public function __construct( stdClass $taxonomy ) {

         foreach ( get_object_vars( $taxonomy ) as $key => $value ) {
             $this->{ $key } = $value;
         }
     }

     public function __toString() {

         return $this->name;
     }

 }
 }}}

 In the `wp_update_term` function, all we'd have to do is this:

 {{{
 $taxonomy_object = new WP_Taxonomy( get_taxonomy( $taxonomy ) );
 do_action( 'edited_term_taxonomy', $tt_id, $taxonomy_object );
 }}}

 Same for `edit_term_taxonomy`, as mentioned by [comment:2 valendesigns].

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


More information about the wp-trac mailing list