Title: Remove Filter
Last modified: February 14, 2019

---

# Remove Filter

 *  Resolved [zdmdesigns](https://wordpress.org/support/users/zmdesignz/)
 * (@zmdesignz)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/remove-filter-2/)
 * Hello,
 * I love your plugin except the permalink override within the post edit screen 
   is a game changer for us because it creates redirects instead up updating the
   post’s real permalink. We use the plugin more for category slug overrides.
 * I’ve found the following filter in class-custom-permalinks-form.php which controls
   this behavior:
 *     ```
       class Custom_Permalinks_Form {
       ...
       add_filter( 'get_sample_permalink_html',
             array( $this, 'custom_permalinks_get_sample_permalink_html' ), 10, 4
           );
       ...
       ```
   
 * I have tried to use a remove_filter in functions.php but it’s not working for
   me. Here are the two snippets I’ve tried:
 *     ```
       remove_filter('get_sample_permalink_html', array('Custom_Permalinks_Form', 'custom_permalinks_get_sample_permalink_html'), 10, 4 );
   
       global $Custom_Permalinks_Form;
       remove_filter( 'get_sample_permalink_html', array($Custom_Permalinks_Form, 'custom_permalinks_get_sample_permalink_html') , 10, 4 );
       ```
   
 * Can you lend a hand in providing the correct remove_filter snippet so I do not
   have to edit the core plugin. Thanks kindly in advance!
    -  This topic was modified 7 years, 3 months ago by [zdmdesigns](https://wordpress.org/support/users/zmdesignz/).

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

 *  Thread Starter [zdmdesigns](https://wordpress.org/support/users/zmdesignz/)
 * (@zmdesignz)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/remove-filter-2/#post-11207120)
 * Please also make sure the filter removal restores the default single in-post 
   edit permalink behavior for ALL USERS. I noticed when commenting out the filter
   code in class-custom-permalinks-form.php > line 19, it only restored it for those
   posted by my User.
 *  Plugin Author [Sami Ahmed Siddiqui](https://wordpress.org/support/users/sasiddiqui/)
 * (@sasiddiqui)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/remove-filter-2/#post-11256167)
 * Hi [@zmdesignz](https://wordpress.org/support/users/zmdesignz/)
 * There is a filter which may works in your scenario. Try the to add the below 
   code in your functions.php file.
 *     ```
       function yasglobal_exclude_post_types( $post_type ) {
         if ( $post_type == 'post' ) {
           return '__true';
         }
         return '__false';
       }
       add_filter( 'custom_permalinks_exclude_post_type', 'yasglobal_exclude_post_types');
       ```
   
 * Above filter is excluding the plugin to work on `post`. You can change this according
   to your need.
 * Let me know if you have any other question.
 * Thanks,
    Sami
 *  Plugin Author [Sami Ahmed Siddiqui](https://wordpress.org/support/users/sasiddiqui/)
 * (@sasiddiqui)
 * [7 years ago](https://wordpress.org/support/topic/remove-filter-2/#post-11603185)
 * [@zmdesignz](https://wordpress.org/support/users/zmdesignz/) As I haven’t heard
   back from you so marking this thread as resolved. Please open the new thread 
   if you have any issues.
 * Sami
 *  Thread Starter [zdmdesigns](https://wordpress.org/support/users/zmdesignz/)
 * (@zmdesignz)
 * [7 years ago](https://wordpress.org/support/topic/remove-filter-2/#post-11604067)
 * Hi Sami,
 * My apologies for not posting a response. Got so busy, I forgot. Your solution
   worked great! Thanks for helping me out on this.
 *  Plugin Author [Sami Ahmed Siddiqui](https://wordpress.org/support/users/sasiddiqui/)
 * (@sasiddiqui)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/remove-filter-2/#post-11628244)
 * [@zmdesignz](https://wordpress.org/support/users/zmdesignz/) Thanks for the update
   and good to hear about that 🙂

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

The topic ‘Remove Filter’ is closed to new replies.

 * ![](https://ps.w.org/custom-permalinks/assets/icon.svg?rev=1785367)
 * [Custom Permalinks](https://wordpress.org/plugins/custom-permalinks/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-permalinks/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-permalinks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-permalinks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-permalinks/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Sami Ahmed Siddiqui](https://wordpress.org/support/users/sasiddiqui/)
 * Last activity: [6 years, 12 months ago](https://wordpress.org/support/topic/remove-filter-2/#post-11628244)
 * Status: resolved