• Resolved mcdeth

    (@mcdeth)


    Hello. There was a known bug that when category slugs are disabled, from time to time happened 404. I was curious if it was fixed? If not, how to protect from this case? By making sure each slug is unique or?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    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

    Plugin Support Rank Math Support

    (@rankmathsupport)

    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

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘404 with WPML’ is closed to new replies.