How to fix URL segment conflict from page and post type URL?

Question

I have two different pages like,

1 :- http://example.com/notebook/note-name-x/ // Real Page
2 :- http://example.com/resource/note-description-x/ // Created by post type

Then i have changed second link URL to,

http://example.com/notebook/note-name-x/note-description-x/

by using,

function nb_add_rewrite_rules( $rules ) {
  $new = array();
  $new['notebook/([^/]+)/(.+)/?$'] = 'index.php?nb_post_type=$matches[2]';
  $new['notebook/(.+)/?$'] = 'index.php?nb_post_taxo=$matches[1]';

  return array_merge( $new, $rules );
}
add_filter( 'rewrite_rules_array', 'nb_add_rewrite_rules' );

But due to this change my first page content is not displaying properly due to second segment notebook conflict.

How can this be solved?

0
Alex Brend 2 months 0 Answers 17 views 0

Leave an answer