From 7c09cd79c2dbb35a3ac59e459bc6734664d98b2d Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Thu, 8 May 2025 16:44:09 +0200 Subject: [PATCH] Flush Rewrite Rules later --- includes/class-frontend.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/class-frontend.php b/includes/class-frontend.php index 30ab7f59..89a33efb 100644 --- a/includes/class-frontend.php +++ b/includes/class-frontend.php @@ -99,7 +99,7 @@ private function register_hooks() { add_filter( 'friends_header_widget_title', array( $this, 'header_widget_title' ) ); add_filter( 'get_edit_post_link', array( $this, 'friend_post_edit_link' ) ); add_filter( 'template_include', array( $this, 'template_override' ) ); - add_filter( 'wp_loaded', array( $this, 'add_rewrite_rule' ) ); + add_filter( 'plugins_loaded', array( $this, 'add_rewrite_rule' ) ); add_filter( 'init', array( $this, 'register_friends_sidebar' ) ); add_action( 'init', array( $this, 'add_theme_supports' ) ); add_action( 'wp_ajax_friends_publish', array( $this, 'ajax_frontend_publish_post' ) ); @@ -152,8 +152,7 @@ public function add_rewrite_rule() { } if ( $needs_flush ) { - global $wp_rewrite; - $wp_rewrite->flush_rules(); + flush_rewrite_rules(); } }