We have created custom post type by function.php and changing URL by category alais before the name by below code
function custom_post_link( $post_link, $id = 0 ){
$post = get_post($id);
if ( is_object( $post )){
$terms = wp_get_object_terms( $post->ID, 'custom_category' );
if( $terms ){
return str_replace( '%custom_category%' , $terms[0]->slug , $post_link );
}
}
return $post_link;
}
add_filter( 'post_type_link', 'custom_post_link', 1, 3 );
after using this script pages redirection error with multiple "301 redirection on page issues".
Suggest, if any have solution about this.
- 0 like
- 0 comment