Custom Post Type Rewrite
-
My rewrites don’t seem to be working. I got them to work by adding
add_filter('post_type_link', 'events_permalink_structure', 10, 4); function events_permalink_structure($post_link, $post, $leavename, $sample) { if ( false !== strpos( $post_link, '%types%' ) ) { $event_type_term = get_the_terms( $post->ID, 'types' ); $post_link = str_replace( '%types%', array_pop( $event_type_term )->slug, $post_link ); } return $post_link; }
to the bottom of the posttypes file but the breadcrumb is still not correct. Still just events/postname
In Custom Tax I have:
'rewrite' => array( 'slug' => 'event-type' ),
And in Custom PT I have:
'rewrite' => array( 'slug' => 'events/%types%','with_front' => false ),
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom Post Type Rewrite’ is closed to new replies.