3

In my theme is a custom post type for events.

On the category pages for these custom post types no trailing slash is being added to the URL in the canonical tag when there should be.

What could be causing this and how can I fix it?

-1

Look at this:

function append_query_string( $url, $post ) {
    if ( 'tour-item' == get_post_type( $post ) ) {
        return add_query_arg( $_GET, $url );
    }
    return $url . '/';

    if ( 'destinations' == get_post_type( $post ) ) {
        return add_query_arg( $_GET, $url );
    }
    return $url . '/';
}
add_filter( 'post_type_link', 'append_query_string', 10, 2 );
  • 1
    If this is a solution, can you add how the OP would apply it? – dan Jun 14 '18 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.