I have a wordpress site using a custom post type "gallery" to show some photos. I can't find the right regex to match my url variables (i'm a novice with regex)
What i want to achieve is to get this form of url :
/custom_post_type_slug/custom_post_type_name/page_num/photo_id/
in my case it should give :
/gallery/name-of-gallery/1/15/
I've tried this regex :
add_rewrite_rule( 'gallery/(.+?)(?:/([0-9]+))?/([0-9]{1,2})/([0-9]{1,2})/?$', 'index.php?gallery=$matches[1]&page=$matches[2]&photo=$matches[3]','top' );
with no success.
When I test this rewrite rule with Query Monitor it tells that photo=$matches[3] and page is null.
If someone could give me an advise it will be very nice.