Skip to content

Commit d25c836

Browse files
committed
Flush rewrite rules when any option updated
1 parent a55e28b commit d25c836

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

archive-pages-taxonomy.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,16 @@ function archive_pages_replace_term_link( $termlink, $term, $taxonomy ){
213213
return $termlink;
214214

215215
}
216-
add_filter('term_link', 'archive_pages_replace_term_link', 10, 3);
216+
add_filter( 'term_link', 'archive_pages_replace_term_link', 10, 3 );
217+
218+
/**
219+
* Flush rewrite rules when one of the options on the settings page is set or updated
220+
* */
221+
function archive_pages_flush_rewrites( $option_name, $old_value, $value ){
222+
223+
if ( str_starts_with( $option_name, 'archive_page_') ){
224+
flush_rewrite_rules();
225+
}
226+
227+
}
228+
add_action( 'updated_option', 'archive_pages_flush_rewrites', 10, 3 );

0 commit comments

Comments
 (0)