Portfolio items do not display
-
Hi there,
I’m having trouble with some CPT UI custom code that removes s category from my slugs.
This, it does fine, but it also makes the portfolio items not being displayed.Things go wrong with the second function.
function cptui_demo_remove_slug_from_permalink_string( $post_link, $post ) { if ( 'publish' !== $post->post_status ) { return $post_link; } if ( 'diensten' === $post->post_type ) { $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link ); } return $post_link; } add_filter( 'post_type_link', 'cptui_demo_remove_slug_from_permalink_string', 10, 2 ); function cptui_demo_add_post_type_to_query( $query ) { if ( is_admin() || ! $query->is_main_query() ) { return; } if ( empty( $query->query['name'] ) ) { return; } $query->set( 'post_type', [ 'post', 'page', 'diensten', ] ); } add_action( 'pre_get_posts', 'cptui_demo_add_post_type_to_query' );Hope you can help!
Thanks
Bye
Ward
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘Portfolio items do not display’ is closed to new replies.