- Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236
chodgson
MemberWarning: Cannot modify header information - headers already sent by (output started at /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 220I have added to my posts a custom taxonomy called “Location”. (see below)
The wp admin area allows me to add a link to the archive in the menu however, when you click on the link it returns a single post and not the archive.
Can you point me in the right direction as to where I can include the generation of an archive page for the custom taxonomy.
Code I added into theme functions:
// Register Custom Taxonomy
function custom_taxonomy_location() {$labels = array(
‘name’ => _x( ‘Locations’, ‘Taxonomy General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Location’, ‘Taxonomy Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Locations’, ‘text_domain’ ),
‘all_items’ => __( ‘All Locations’, ‘text_domain’ ),
‘parent_item’ => __( ‘Parent Location’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Parent Location:’, ‘text_domain’ ),
‘new_item_name’ => __( ‘New Location Name’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Location’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Location’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Location’, ‘text_domain’ ),
‘separate_items_with_commas’ => __( ‘Separate Locations with commas’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Locations’, ‘text_domain’ ),
‘add_or_remove_items’ => __( ‘Add or remove Locations’, ‘text_domain’ ),
‘choose_from_most_used’ => __( ‘Choose from the most used Locations’, ‘text_domain’ ),
);
$rewrite = array(
‘slug’ => ‘location’,
‘with_front’ => true,
‘hierarchical’ => true,
);
$args = array(
‘labels’ => $labels,
‘hierarchical’ => true,
‘public’ => true,
‘show_ui’ => true,
‘show_admin_column’ => true,
‘show_in_nav_menus’ => true,
‘show_tagcloud’ => true,
‘rewrite’ => $rewrite,
);
register_taxonomy( ‘location’, ‘post’, $args );}
// Hook into the ‘init’ action
add_action( ‘init’, ‘custom_taxonomy_location’, 0 );AdvertismentDeprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236Daniel Tara
KeymasterWarning: Cannot modify header information - headers already sent by (output started at /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 220I believe it’s a permalink issue. Try saving your permalink structure twice and see if the issue still persists.
Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/html/dev/wp/wp-includes/formatting.php on line 4371Notice: Trying to get property 'comment_author_email' of non-object in /var/html/dev/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 236chodgson
MemberWarning: Cannot modify header information - headers already sent by (output started at /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /var/html/dev/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_wp.class.php on line 220Yes! It was a permalink issue. I think there was a clash of similar slugs. So it now works fine. Many thanks for pointing me in the right direction.
Tagged: Custom Taxonomy
You must be logged in to reply to this topic.