unexpected problem in url rewrite

first, you need to add your custom_gallery_id to query vars if you haven’t already:

add_filter( 'query_vars', 'wpse26388_query_vars' );
function wpse26388_query_vars( $query_vars ){
    $query_vars[] = 'custom_gallery_id';
    return $query_vars;
}

for your rewrite rule, you need to load a WordPress object– a page, a category, etc., and all internal rewrites must point to index.php. if topic, place, and new delhi are all pages, it would look something like this:

function wpse26388_rewrites_init(){
    add_rewrite_rule(
        'topic/([^/]+)/([^/]+)/gallery/([0-9]+)/?$',
        'index.php?pagename=topic/$matches[1]/$matches[2]&custom_gallery_id=$matches[3]',
        'top' );        
}

also try out this plugin for analyzing and testing your rewrite rules.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)