URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php

The issue is that %month% isn’t a recognized rewrite tag. If you add the tag within your init action and flush permalinks, the query will succeed.

function register_story_post_type(){
    // your post type registration stuff here, and then…
    add_rewrite_tag( '%month%','([^&]+)' );
}
add_action('init','register_story_post_type');

There are also about a hundred ways you could otherwise clean up that code, but none relevant to your issue here. One thing I recommend though is to not manipulate rewrite globals directly, this is a bad habit that can get you in trouble if the underlying code changes. Always use the API and avoid globals. Your story rewrite tag is added when you register your post type, and the rewrite structure can be defined directly within your post type registration code using the rewrite argument.

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