Support

Account

Home Forums Backend Issues (wp-admin) Change Taxonomy Terms to Slugs in Admin Post Editor Reply To: Change Taxonomy Terms to Slugs in Admin Post Editor

  • Ok, so there is a hack way of doing what I want.

    In taxonomy.php i modified line 1020 from this:

    		// append
    		$output .= '<li data-id="' . $term->term_id . '"><label><input type="' . $this->field['field_type'] . '" name="' . $this->field['name'] . '" value="' . $term->term_id . '" ' . ($selected ? 'checked="checked"' : '') . ' /> <span>' . $term->name . '</span></label>';
    				
    	}

    to this:

    // append
    		$output .= '<li data-id="' . $term->term_id . '"><label><input type="' . $this->field['field_type'] . '" name="' . $this->field['name'] . '" value="' . $term->term_id . '" ' . ($selected ? 'checked="checked"' : '') . ' /> <span>'. $term->slug .'-' . $term->name . '</span></label>';
    				
    	}

    adding in the ‘$term->slug’ in the label span.

    So now a term looks like:

    1132-Forest Nurseries and Gathering of Forest Products

    With 1132 being the slug.

    This isn’t a good solution, since it could get overwritten, so just need to find out how to make that work….
    Especially because I have a second Taxonomy field (different taxonomy) that I don’t want the slug to show up on….