Hello @mcdeth,
Thank you for your query and we are so sorry about the trouble this must have caused.
This can be resolved by flushing your permalink caches. To do that, please head over to your WordPress Dashboard → Settings → Permalink and save the settings without changing anything.
Let us know how that goes. Looking forward to helping you.
Thread Starter
mcdeth
(@mcdeth)
this is a super ugly workaround because you never know when 404 happens. i’d have to literally refresh page evrey second
Hello @mcdeth,
This issue is tied to how WordPress handles permalinks when category slugs are removed. As a workaround, you can automate flushing the permalink cache with this code:
add_action('my_hourly_event', 'do_this_hourly');
function my_activation() {
if ( !wp_next_scheduled( 'my_hourly_event' ) ) {
wp_schedule_event(time(), 'hourly', 'my_hourly_event');
}
}
add_action('wp', 'my_activation');
function do_this_hourly() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
You can refer to this guide on adding code: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps.
Thread Starter
mcdeth
(@mcdeth)
Yes thanks. it’s less ugly but still very ugly workaround that destroys concept of cache.
what’s causing these 404 so that we could at least try preventing