Is there an action for when permalinks are rebuilt?

In my plugin, I have a list of titles and permalinks in the options table. It’s updated every time my custom post type is saved.

Since I’m saving permalinks the option data can become bad if the user changes their permalink structure.

Read More

I need a action that I can hook into that happens whenever the permalink structure is updated. Is there one?

Related posts

Leave a Reply

1 comment

  1. The action is update_option_permalink_structure. You get the old and the new value as parameters.

    add_action( 'update_option_permalink_structure' , 'my_custom_function', 10, 2 );
    
    function my_custom_function( $oldvalue, $_newvalue )
    {
        // do something
    }
    

    There are also the actions update_option_category_base and update_option_tag_base.