• Resolved zdmdesigns

    (@zmdesignz)


    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 6 years, 1 month ago by zdmdesigns.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter zdmdesigns

    (@zmdesignz)

    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

    (@sasiddiqui)

    Hi @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

    (@sasiddiqui)

    @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

    (@zmdesignz)

    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

    (@sasiddiqui)

    @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.