I have a custom taxonomy, called "location", everything works fine, I can use it for labeling "open job position", but the problem occurs, when I try to access the archive or click on a taxonomy tag.
I have:
- reset the permalinks many times
- double checked the query
- double checked arguments
- seen this: Custom taxonomy archive - No posts found && Custom Taxonomy returns no posts
Here is the code:
if ( ! function_exists( 'custom_taxonomy_career' ) ) {
// Register Custom Taxonomy
function custom_taxonomy_career() {
$labels = array(
'name' => _x( 'Locations', 'Taxonomy General Name', 'foxconndrc' ),
'singular_name' => _x( 'Location', 'Taxonomy Singular Name', 'foxconndrc' ),
'menu_name' => __( 'Locations', 'foxconndrc' ),
'all_items' => __( 'All Items', 'foxconndrc' ),
'parent_item' => __( 'Parent Item', 'foxconndrc' ),
'parent_item_colon' => __( 'Parent Item:', 'foxconndrc' ),
'new_item_name' => __( 'New Item Name', 'foxconndrc' ),
'add_new_item' => __( 'Add New Item', 'foxconndrc' ),
'edit_item' => __( 'Edit Item', 'foxconndrc' ),
'update_item' => __( 'Update Item', 'foxconndrc' ),
'view_item' => __( 'View Item', 'foxconndrc' ),
'separate_items_with_commas' => __( 'Separate items with commas', 'foxconndrc' ),
'add_or_remove_items' => __( 'Add or remove items', 'foxconndrc' ),
'choose_from_most_used' => __( 'Choose from the most used', 'foxconndrc' ),
'popular_items' => __( 'Popular Items', 'foxconndrc' ),
'search_items' => __( 'Search Items', 'foxconndrc' ),
'not_found' => __( 'Not Found', 'foxconndrc' ),
'no_terms' => __( 'No items', 'foxconndrc' ),
'items_list' => __( 'Items list', 'foxconndrc' ),
'items_list_navigation' => __( 'Items list navigation', 'foxconndrc' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true,
'exclude_from_search' => false,
'rewrite' => array( 'slug' => 'career_location' ),
);
register_taxonomy( 'career_location', array( 'career', 'post' ), $args );
}
add_action( 'init', 'custom_taxonomy_career', 0 );
}
Here is whole CPT with the code: https://pastebin.com/LqEkv0ZW
$labels
are essential in your question? And will somebody go to the third-party site to view your code? I see the general code you've published with no alterations. It's a standard. Rethink and edit.