File tree Expand file tree Collapse file tree 6 files changed +31
-1
lines changed
Expand file tree Collapse file tree 6 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ function tootpress_restore_factory_settings() {
131131 // CSS Option requires an inverse value (please do not ask why)
132132 update_option ('tootpress_css ' ,"0 " );
133133 update_option ('tootpress_backlink ' ,'0 ' );
134+ update_option ('tootpress_rewrite_update ' ,'0 ' );
134135 update_option ('tootpress_developer ' ,"0 " );
135136
136137 global $ wpdb ;
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ function tootpress_activate () {
4444 add_option ('tootpress_navigation ' ,"standard " );
4545 add_option ('tootpress_css ' ,'1 ' );
4646 add_option ('tootpress_backlink ' ,'0 ' );
47+ add_option ('tootpress_rewrite_update ' ,'0 ' );
4748 add_option ('tootpress_developer ' ,"0 " );
4849 }
4950
@@ -91,6 +92,7 @@ function tootpress_delete () {
9192 delete_option ('tootpress_navigation ' );
9293 delete_option ('tootpress_css ' );
9394 delete_option ('tootpress_backlink ' );
95+ delete_option ('tootpress_rewrite_update ' );
9496 delete_option ('tootpress_developer ' );
9597 }
9698
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ function tootpress_options_menu() {
3030
3131function tootpress_options_content () {
3232
33+ // Post-Processing
34+
35+ if (get_option ('tootpress_rewrite_update ' )) {
36+ tootpress_rewrite_update ();
37+ }
38+
3339 // Header
3440 echo '
3541 <div class="wrap">
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ function tootpress_update() {
4040 if (tootpress_ready_to_retrieve_toots_from_mastodon_api ()) {
4141 tootpress_retrieve_mastodon_account ();
4242 }
43+ add_option ('tootpress_rewrite_update ' ,'0 ' );
4344 }
4445
4546}
Original file line number Diff line number Diff line change @@ -146,4 +146,24 @@ function tootpress_retrieve_mastodon_account() {
146146
147147}
148148
149+ /**
150+ * Update Rewrite Rules
151+ *
152+ * @since 0.3
153+ *
154+ * @return null
155+ */
156+
157+ function tootpress_rewrite_update () {
158+
159+ $ update_rewrites =get_option ('tootpress_rewrite_update ' );
160+
161+ if ($ update_rewrites ) {
162+ flush_rewrite_rules ();
163+ }
164+
165+ update_option ('tootpress_rewrite_update ' ,'0 ' );
166+
167+ }
168+
149169?>
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ function tootpress_validate_page_id ($pageid) {
147147 }
148148 // If new ID is given
149149 elseif ($ pageid <>get_option ( 'tootpress_page_id ' )) {
150- flush_rewrite_rules ( );
150+ update_option ( ' tootpress_rewrite_update ' , ' 1 ' );
151151 }
152152 }
153153
You can’t perform that action at this time.
0 commit comments