Support » Plugin: Permalinks Customizer » How to regenerate a specific post id in my function.php ?

  • Resolved wedgemaster

    (@wedgemaster)


    Hello,

    I’m creating by code a post
    but it doesn’t use the structure i give in the permalink customizer plugin.

    So after creating, i want to execute a function to regenerate and get the right structure.

    How to do it ?

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

    (@sasiddiqui)

    Hi @wedgemaster

    Sorry for the delay in my response. There is no such way to generate the permalink as of now.

    I have added the functionality which needs to be tested. You may get the plugin with the updated from the Github:
    https://github.com/yasglobal/permalinks-customizer/tree/generate_permalink

    Just update the code from the repo and add the following action from where you are creating the post.
    do_action( 'pc_generate_permalink', $post_id );

    NOTE: Replace $post_id with the post id for which you need to generate the permalink.

    Please provide your feedback so, I may officially release this.

    Thanks,
    Sami

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @wedgemaster

    I have released this feature in the v2.7.0. You may test it out if you still have this requirement or for future use.

    Regards,
    Sami

    Thank you Sami. This has proved invaluable to me.

    One observation. In my case I was updating posts (as well as creating them). When updating I found that a call to:
    do_action( 'pc_generate_permalink', $post_id);
    on its own didn’t do the trick. I found that I needed the following line first, prior to the do_action:
    update_post_meta( $post_id, 'permalink_customizer_regenerate_status', 0 );
    then it worked for me. Don’t know if that is the best way.

    Thank you for all your work on such a great plugin.

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    @briancryer pc_generate_permalink action suppose that you are creating the post. In that case, it works perfectly. Otherwise, you need to define that as you mentioned.

    Thanks,
    Sami

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