[wp-trac] [WordPress Trac] #36252: Allowed memory size exhausted on up_update_term

WordPress Trac noreply at wordpress.org
Tue Mar 15 15:29:12 UTC 2016


#36252: Allowed memory size exhausted on up_update_term
-----------------------------------------+-----------------------------
 Reporter:  rahal.aboulfeth              |      Owner:
     Type:  defect (bug)                 |     Status:  new
 Priority:  normal                       |  Milestone:  Awaiting Review
Component:  General                      |    Version:  4.4.2
 Severity:  normal                       |   Keywords:
  Focuses:  administration, performance  |
-----------------------------------------+-----------------------------
 Hello,

 I have a category with a lot of posts ( more than 70000 ) , and I can't
 update it from the dashboard because of a Allowed memory exhaustion error.

 After reviewing wp_update_term code, I noticed this section line 3282 in
 taxonomy.php :
 {{{#!php
 <?php
         // Clean the relationship caches for all object types using this
 term.
         $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM
 $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
         $tax_object = get_taxonomy( $taxonomy );
         foreach ( $tax_object->object_type as $object_type ) {
                 clean_object_term_cache( $objects, $object_type );
         }


 }}}

 In my case objects is an array with more than 70000 rows, and this is
 probably what caused the memory exhaustion. I commented this section and
 the update started working again.


 Now, I don't really get why we should clean all those caches.
 I think the same behavior is also present in wp_delete_term.


 Thank you

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36252>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list