Title: Code Snipped to modify Plugin
Last modified: September 1, 2017

---

# Code Snipped to modify Plugin

 *  [Dariusz](https://wordpress.org/support/users/idarek/)
 * (@idarek)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/code-snipped-to-modify-plugin/)
 * I am trying to look on using Code Snipped to modify Plugin.
 * Don’t know if that’s possible, so maybe somebody could help on that. I am not
   an expert.
 * I am using [HTML5 Responsive FAQ](https://en-gb.wordpress.org/plugins/html5-responsive-faq/)
   plugin that got in main Plugin File html5-responsive-faq/html5-responsive-faq.
   php
 *     ```
       function register_hrf_faq() {
   
          register_post_type('hrf_faq', array(
   
                'rewrite'         => array(
                                        'slug'       => 'hrf_faq',
       ```
   
 * I have paste only a part of this function.
 * Is it possible using Code Snipped replace ‘hrf_faq’ to ‘faq’ only (in ‘slug’ 
   part)
 * Tries to use str_replace but apart of brake of the website, haven’t got any success.
    -  This topic was modified 8 years, 9 months ago by [Dariusz](https://wordpress.org/support/users/idarek/).

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

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/code-snipped-to-modify-plugin/#post-9462925)
 * A quick web search reveals [this WordPress Stack Exchange question](https://wordpress.stackexchange.com/a/42164/19726),
   which suggests that this is not very simple, but is possible.
 * Here’s a sample code snippet:
 *     ```
       add_action( 'init', function () {
           if ( $current_rules = get_option( 'rewrite_rules' ) ) {
               foreach ( $current_rules as $key => $val ) {
                   if ( strpos( $key, 'hrf_faq' ) !== false ) {
                       add_rewrite_rule( str_ireplace( 'hrf_faq', 'faq', $key ), $val, 'top' );
                   }
               }
   
           }
           flush_rewrite_rules();
       } );
       ```
   
    -  This reply was modified 8 years, 9 months ago by [Shea Bunge](https://wordpress.org/support/users/bungeshea/).
 *  Thread Starter [Dariusz](https://wordpress.org/support/users/idarek/)
 * (@idarek)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/code-snipped-to-modify-plugin/#post-9464022)
 * Thank you, will have a try.

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

The topic ‘Code Snipped to modify Plugin’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Dariusz](https://wordpress.org/support/users/idarek/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/code-snipped-to-modify-plugin/#post-9464022)
 * Status: not a support question