Support » Plugin: Custom Permalinks » Reverts to old permalink structure on update

  • Resolved telecomnepali

    (@telecomnepali)


    Hi Sir
    This is for the latest update 1.7.1, if we update the old post, the permalink structure changes to the normal one.
    So I have reverted back to the 1.7.0 version and changed the permalink again which is fine now.
    Can you check on the latest version, I do not know if it’s just for our case. Using Classic editor for now.

    Hoping for your reply.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @telecomnepali

    Does it showing you the different permalink when you open edit post page? Does it throwing you any JS error in your browser console?

    This issue was reported in v1.6.0 and fixed in v1.7.0. v1.7.0 and v1.7.1 doesn’t have any major change except the permission fix so I don’t think it makes an issue.

    Let me know about your browser console errors. Also, please update 2-3 more posts in v1.7.1 to verify this issue, before doing any change please save the current customized plugin to avoid any issue.

    Thanks and Regards,
    Sami

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    @telecomnepali As per not getting any response, I am marking this thread as resolved. Please feel free to open a new thread if you face any issue.

    Thanks and Regards,
    Sami

    Jtree5757

    (@jtree5757)

    Hey @sasiddiqui

    I encountered this might be related, but if you have a custom permalink saved, then open the current post as a preview, then go back to the other tab where you’re editing the post and save it, the custom permalink will get deleted. Meaning it reverts to the default permalink/slug.

    The issue is in class-custom-permalinks-form.php. Specifically this line:
    add_action( 'delete_post', array( $this, 'delete_permalink' ), 10 );

    When a preview is opened, wp creates a new post and the type is set to revision. The next time you save any updates, the revision gets deleted and the delete_permalink method gets called with the revision’s post id. Which makes sense so far. But wp actually converts any revision id to the real id whenever it deals with post meta with the use of this function https://developer.wordpress.org/reference/functions/wp_is_post_revision/!

    I think you can just delete add_action( 'delete_post', array( $this, 'delete_permalink' ), 10 ); because wp already cleans up the meta table when a post gets deleted. I removed the action on one of my client’s sites and it’s working as expected now.

    Hope that helps

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.