Results 1 to 4 of 4

Thread: WP 4.2.1 - Category - Taxonomy Selecting Fix

  1. #1
    Thread Starter
    Senior Member frcamp's Avatar
    Join Date
    Nov 2010
    Location
    United States
    Posts
    192
    Thanks
    3
    Thanked 10 Times in 8 Posts

    WP 4.2.1 - Category - Taxonomy Selecting Fix

    This is WP core fix (temp)

    If you have WP 4.2.1 and have lots of category with 2-3 level child, you probably noticed dramatic drop down in speed - maybe even times out and dies - when you /or user try to list an ad and selecting categories. (category dropdown)

    The issue is with WP wp-includes/taxonomy.php

    Here is temporary fix - (until WP release it's fix)-

    You will see an incredible speed difference - in how categories select loads categories in steps of: parent/child/grand-child

    Test it before - and test it after!

    Open: wp-includes/taxonomy.php


    instruction:
    //from = this is what you comment out
    //change to// = this is the new line you add

    around - line 3943
    find section


    // Include the term itself in the ancestors array, so we can properly detect when a loop has occurred.
    if ( empty( $ancestors ) ) {
    //from $ancestors[] = $term_id;
    $ancestors[ $term_id ] = 1; //change to//
    }

    foreach ( (array) $terms as $term ) {
    $use_id = false;
    if ( !is_object($term) ) {
    $term = get_term($term, $taxonomy);
    if ( is_wp_error( $term ) )
    return $term;
    $use_id = true;
    }

    // Don't recurse if we've already identified the term as a child - this indicates a loop.
    //from if ( in_array( $term->term_id, $ancestors ) ) {
    if ( isset( $ancestors[ $term->term_id ] ) ) { //change to//
    continue;
    }

    if ( $term->parent == $term_id ) {
    if ( $use_id )
    $term_list[] = $term->term_id;
    else
    $term_list[] = $term;

    if ( !isset($has_children[$term->term_id]) )
    continue;

    //from if ( $use_id ) {
    //from $ancestors = array_merge( $ancestors, $term_list );
    //from } else {
    //from $ancestors = array_merge( $ancestors, wp_list_pluck( $term_list, 'term_id' ) );
    //from }
    $ancestors[ $term->term_id ] = 1;; //change to//
    if ( $children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors) )
    $term_list = array_merge($term_list, $children);
    }
    }

  2. #2
    Veteran bellboy's Avatar
    Join Date
    Apr 2010
    Location
    Tokyo, Japan
    Posts
    515
    Thanks
    132
    Thanked 43 Times in 36 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Thread Starter
    Senior Member frcamp's Avatar
    Join Date
    Nov 2010
    Location
    United States
    Posts
    192
    Thanks
    3
    Thanked 10 Times in 8 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    Thread Starter
    Senior Member frcamp's Avatar
    Join Date
    Nov 2010
    Location
    United States
    Posts
    192
    Thanks
    3
    Thanked 10 Times in 8 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Price not displaying after selecting category
    By manishkhullar in forum ClassiPress General Discussion
    Replies: 1
    Last Post: September 2nd, 2013, 04:34 AM
  2. Samcy button after selecting the category
    By gravedigger in forum Help Using ClassiPress
    Replies: 9
    Last Post: May 31st, 2013, 11:04 AM
  3. Selecting a Category in Step 1 of posting an Ad
    By dell in forum ClassiPress General Discussion
    Replies: 1
    Last Post: November 3rd, 2011, 08:46 PM
  4. [SOLVED] When Posting Ad Nothing Is Happening After Selecting Category
    By nepaclick in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: August 10th, 2011, 08:09 AM
  5. [SOLVED] Error - Posting an Ad and Selecting a Category
    By lucabrasi in forum Report ClassiPress Bugs
    Replies: 4
    Last Post: February 2nd, 2011, 03:23 PM