Permalinks are (finally) working for individual posts of the custom yoga-event
type I've created.
And archive works without URL rewriting:
http://website.localhost/?post_type=yoga-event
However get_post_type_archive_link( 'yoga-event' )
returns false.
This is the array I'm sending to register_post_type
:
Array
(
[labels] => Array
(
[name] => Yoga Events
[singular_name] => Yoga Event
[menu_name] => Yoga Events
[all_items] => Yoga Events
[add_new] => Add New
[add_new_item] => Add New Yoga Event
[edit_item] => Edit Yoga Event
[new_item] => New Yoga Event
[view_item] => View Yoga Event
[search_items] => Search Yoga Events
[not_found] => No Yoga Events found
[not_found_in_trash] => No Yoga Events found in Trash
[parent_item_colon] => Parent Yoga Event:
)
[public] => 1
[rewrite] => Array
(
[slug] => yoga-event
)
[has_arhchive] => 1
[menu_icon] => dashicons-book-alt
)
I can sort of make my own "archive" like this:
$type = 'yoga-event';
$args=array(
'post_type' => $type,
'post_status' => 'publish',
'posts_per_page' => -1,
'ignore_sticky_posts'=> 1);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) :
$my_query->the_post();
?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?> </a></p>
<?php
endwhile;
} // list of yoga-event items
But I'm guessing that the array that register_post_type
is getting has some kind of misconfiguration.
Any insights?
PS:
//List Post Types
foreach ( get_post_types( '', 'names' ) as $post_type ) {
echo '<p>' . $post_type . '</p>';
}
Returns yoga-event
(among others).
has_arhchive
, is that also in your code?