Support » Fixing WordPress » 10 000 terms and taxonomy records with 10 posts?

  • I have latest WordPress blog and about 10 posts on it (and pages). But it’s very very slow on front end in edit menu page.

    I’ve investigated i have 10 000 rows in wp_terms and the same in wp_term_taxonomy.

    In wp_terms mostly it is “No Category” with slug “no-category-gallerie-7” and in taxonomy galleries with description Default Category.

    I’ve found in slow query log that this query is very slow:

    # User@Host: d @ localhost []
    # Thread_id: 14082944 Schema: Last_errno: 0 Killed: 0
    # Query_time: 0.697988 Lock_time: 0.000057 Rows_sent: 14343 Rows_examined: 14343 Rows_affected: 0 Rows_read: 14343
    # Bytes_sent: 674183
    SET timestamp=1367261448;
    SELECT * FROM d.wp_term_taxonomy;

    Front end loads for 10 seconds, and menu editing for like 30 seconds.

    And it’s getting worse because every time i edit menu new rows add to tables above.

    In taxonomies.php i’ve found that function:

    function query_post_type($query) {
    		global $post;
    		$array_taxos = array('galleries', 'portfolios', 'brochures', 'catalogs');
    		foreach($array_taxos as $taxo){
    			$single_name = substr($taxo, 0, -1);
    			$term_obj = wp_get_object_terms( $post->ID, $taxo);
    				$arr_tes = wp_insert_term(
    					'No Category',
    					array('description'=> "Default Category.",	'slug' => "no-category-$single_name",'parent'=> 0)
    				wp_set_object_terms( $post->ID, array('slug' => "no-category-$single_name"), $taxo, true);

    is responsible for adding rows to the table.

    And i’ve found this error in PHP log multiple times:

    Error Duplicate entry ‘no-category-gallerie-14381’ for key ‘slug’ … INSERT INTO wp_terms (name,slug,term_group) VALUES (‘No Category’,’no-category-gallerie-14381′,0) sent by require(‘/wp-blog-header.php’), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, do_action_ref_array, call_user_func_array, query_post_type, wp_insert_term

    Why there is so much taxonomies and terms? How to fix it?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘10 000 terms and taxonomy records with 10 posts?’ is closed to new replies.