Wordpress Permalinks not working

I have updated to custom permalinks to support buddypress but since recently the permalinks seems to be go not working every few hours or so. I have checked the .htaccess when the permalinks stop working but there is no change yet if I just go to wordpress settings > permalinks and just click save it starts working again though the .htaccess does not get changed. What could be going wrong?

  • aristath

    Hello there @adams, I hope you're well today!

    Try adding the following at the end of your theme's functions.php file:

    if ( ! wp_next_scheduled( 'my_task_hook' ) ) {
    	wp_schedule_event( time(), 'hourly', 'my_task_hook' ); // hourly, daily and twicedaily
    add_action( 'my_task_hook', 'my_task_function' );
    function my_task_function() {
    	//Ensure the $wp_rewrite global is loaded
    	global $wp_rewrite;
    	//Call flush_rules() as a method of the $wp_rewrite object

    This will be the same as pressing that save button once an hour. :wink:

    I hope that helps!


  • adams

    Oh thanks very much. That definitely helps as I was doing it manually. But is there anything that you think could be causing this problem suddenly? I had installed a plugin I remember when this problem started occurring but I have since then deactivated it but the problem remains. And it is strange it happens suddenly irregularly and the save simply fixes it though my .htaccess is not 644 and not writable.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.