This is strange. I have the plugin running on several sites myself and have not had this issue. Also the flush_rewrite_rules() call isn’t new; I just consolidated two separate functions that were both running on the same hook.
I’ll investigate further, but have you verified that this is not a plugin/theme conflict with your specific setup?
Ah… I missed initially that you are running WordPress 4.9. All of my client sites are on 6.0, and I haven’t been specifically testing this with earlier versions.
Is there a particular reason you’ve held back on that version? It’s possible that’s the issue.
That said… the “requires” version for No Nonsense is officially 4.9, so I do need to find a way to resolve this issue.
And that said, I checked the documentation for flush_rewrite_rules() and there are examples (going back 7 years) of using the function with register_activation_hook(), so this error shouldn’t be happening in 4.9 unless you’ve modified the core code or if there’s a plugin/theme conflict.
Let me know about my previous question (whether or not you’ve checked for a plugin/theme conflict), and also whether or not you’ve modified any of the WordPress core, and in the meantime I’ll set up a test install of WP 4.9 and see if I can replicate the issue.
OK, I set up a clean install of WordPress 4.9.21, installed No Nonsense, and it is working properly.

Whatever the issue is appears to be specific to your configuration… most likely a plugin or theme conflict as noted earlier.
Seems you did not follow the description “after plugin update 2.4.1 to 2.5.1”:
- Install fresh WP 4.9.21
- Install No Nonsense 2.4.1
- Change some setting (as example Remove WP emoji) and save (this maybe not required)
- Update to No Nonsense 2.5.1
- Error: Call to a member function flush_rules() on null in /example/wp-includes/rewrite.php on line 273
OK… I installed No Nonsense 2.4.1 and ran the update and I am also getting the fatal error. Investigating…
Please try the upgrade to 2.5.1.1. It resolves the issue for me on my WP 4.9 test site.
I’ve removed the flush_rewrite_rules() call from the r34nono_install() function and added it directly to a separate register_activation_hook() call, which is how it was configured prior to version 2.5.
Plugin update 2.4.1 to 2.5.1.1 works, no PHP error.
Thanks for quick investigation and fix.
But after update I get this message “Thank you for installing No Nonsense. To get started, please visit the Settings page.” even though the plugin was installed and configured before already.
That’s an intentional new feature… but yes it would be better to have it run only on install, not update. I’m working on that.
Version 2.5.2 is out now. I’ve refactored the install/update logic into two separate functions, so now that admin notice will only display on plugin activation, not when running an update.
Everything works as expected now.
Thanks again for quick investigation and fix.