Custom Post Type not using correct page template

The problem is caused by flush_rewrite_rules(). Remove that line and the issue should be resolved.

If you call that function on every page load it can cause issues like this with permalinks. This function should only be run once after your theme or plugin is activated (but not on the activation hook, since that’s too early). This is because permalinks are persistent and should only be flushed if something has changed.

It’s often easier to just manually flush the permalinks by visiting Settings > Permalinks.

deneme bonusu veren sitelerbahis siteleripulibet girişdeneme bonusutürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişholiganbetholiganbet girişholiganbet güncel giriş