optimix-blog / wp-content /mu-plugins /fix-permalinks.php
Eric
Switch to 'Post name' permalink structure and flush rewrite rules
0242427
Raw History Blame Contribute Delete
515 Bytes
<?php
/**
* Plugin Name: OptiMix Permalinks Fix
* Description: Forces clean permalinks by overriding rewrite checks.
*/
// Force WordPress to believe mod_rewrite is enabled
add_filter('got_rewrite', '__return_true', 999);
// Force the permalink structure without writing to the DB
add_filter('pre_option_permalink_structure', function($structure) {
return '/%postname%/';
});
// Flush rewrite rules to ensure the new structure is active
add_action('init', function() {
flush_rewrite_rules();
}, 999);