WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category/Taxonomy bug (3 posts)

  1. dylanj
    Member
    Posted 1 year ago #

    Firstly: this only seems to happen on the live server, never on the local server.

    Here is the issue:

    http://ft.dtupload.com/g/Screen_shot_2012-09-25_at_5.52.04_PM.png

    As you can clearly see, it says "No items found", but also says "3 items" on the very right-hand side.

    Basically, this is a custom taxonomy on a custom post type. Here is the content of my functions.php for my theme:

    add_action('init', 'jobs_setup');
    
    if (!function_exists('jobs_setup')) {
    	function jobs_setup() {
    
    		register_taxonomy(
    			'location',
    			'job',
    			array(
    				'hierarchical' => true,
    				'labels' => array(
    					'name' => 'Locations',
    					'singular_name' => 'Location',
    					'search_items' => 'Search Locations',
    					'popular_items' => 'Popular Locations',
    					'all_items' => 'All Locations',
    					'parent_item' => 'Parent Location',
    					'parent_item_colon' => 'Parent Location:',
    					'edit_item' => 'Edit Location',
    					'update_item' => 'Update Location',
    					'add_new_item' => 'Add New Location',
    					'new_item_name' => 'New Location',
    					'separate_items_with_commas' => 'Seperate locations with commas',
    					'add_or_remove_items' => 'Add or remove locations',
    					'choose_from_most_used' => 'Choose from the most used'
    				)
    			)
    		);
    
    		register_post_type("job", array(
    			"labels" => array(
    				"name" => __("Jobs"),
    				"singular_name" => __("Job"),
    				"add_new" => __("Add New"),
    				"add_new_item" => __("Add New Job"),
    				"edit_item" => __("Edit Job"),
    				"new_item" => __("New Job"),
    				"all_items" => __("All Jobs"),
    				"view_item" => __("View Job"),
    				"search_items" => __("Search Jobs"),
    				"not_found" =>  __("No jobs found"),
    				"not_found_in_trash" => __("No jobs found in Trash"),
    				"parent_item_colon" => "",
    				"menu_name" => "Jobs"
    			),
    			"public" => true,
    			"show_ui" => true,
    			"capability_type" => "post",
    			"supports" => array("title", "editor", "revisions", "thumbnail"),
    			"taxonomies" => array('location', 'category'),
    			"menu_position" => 7,
    			"has_archive" => 'jobs',
    			"show_in_nav_menus" => false
    		));
    	}
    }
    
    // just some excerpt code, shouldn't affect anything
    function new_excerpt_more($more) {
    	global $post;
    	return '...</p><p><a>ID) . '">Read more ยป</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    There is nothing else in functions.php.

    When I try to add a new "Location" taxonomy type, it shows up in the list and I can delete it/edit it etc, but if I refresh the page, it's gone (the number on the right goes up by 1 because I have added one).

    I am also having this exact same problem on:

    Post categories (not a custom post OR taxonomy)
    Post tags (not a custom post OR taxonomy)
    Job categories (custom post, not a custom taxonomy)

    Even when I activate twenty eleven, it still has this bug.

    Is this a common issue? If so, how do I resolve it?

  2. dylanj
    Member
    Posted 1 year ago #

    An update: I have just found this exact same issue on another site which is hosted on the same Debian server. That site was coded by a different developer years ago, so it must be something to do with either the server or WordPress.

    Either way, I'd like to track it down and figure out what's doing it. Anyone got any ideas?

  3. dylanj
    Member
    Posted 1 year ago #

    Okay, I did some digging around and found the query that it was calling to get a list of all the categories:

    SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('location') ORDER BY t.name ASC

    Copy/pasted into phpmyadmin and got an error like this:

    Can't create/write to file '/var/lib/mysql/#sql_5af9_0.MYI' (Errcode: 13)

    Turns out, the permissions on the /tmp directory had been changed for some reason (external to WordPress, obviously), which was causing MySQL to behave strangely!

    Hope anyone else having this issue will find this useful.

Topic Closed

This topic has been closed to new replies.

About this Topic