Title: Coldfight's Replies | WordPress.org

---

# Coldfight

  [  ](https://wordpress.org/support/users/coldfight/)

 *   [Profile](https://wordpress.org/support/users/coldfight/)
 *   [Topics Started](https://wordpress.org/support/users/coldfight/topics/)
 *   [Replies Created](https://wordpress.org/support/users/coldfight/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/coldfight/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/coldfight/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/coldfight/engagements/)
 *   [Favorites](https://wordpress.org/support/users/coldfight/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Custom Posts / Custom Template Files](https://wordpress.org/support/topic/custom-posts-custom-template-files/)
 *  Thread Starter [Coldfight](https://wordpress.org/support/users/coldfight/)
 * (@coldfight)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/custom-posts-custom-template-files/#post-2816185)
 * I figured it out! For anyone who has the same problem, here is the fix:
 *     ```
       add_filter( "single_template", "get_custom_post_type_template" ) ;
   
       function get_custom_post_type_template($single_template) {
            global $post;
   
            if ($post->post_type == 'custom-post-type') {
                 $single_template = dirname( __FILE__ ) . '/single-custom-post-type.php';
            }
            return $single_template;
       }
       ```
   
 * I hope that helps other people!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to correctly call flush_rewrite_rules() ?](https://wordpress.org/support/topic/how-to-correctly-call-flush_rewrite_rules/)
 *  [Coldfight](https://wordpress.org/support/users/coldfight/)
 * (@coldfight)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/how-to-correctly-call-flush_rewrite_rules/#post-2784955)
 * Anybody with an answer?
 * I have that exact same question. The way I’m doing it right now, though (not 
   sure if it’s correct), is:
 *     ```
       function foo() {
           bar();
           flush_rewrite_rules();
       }
       register_activation_hook( __FILE__, 'foo' );
   
       add_action('init', 'bar');
       function bar() {
           //...
           register_post_type( 'other' , $args );
           //register_taxonomy(...);
       }
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)