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.

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

1 Answer
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.

Leave a Reply

Your email address will not be published. Required fields are marked *