Understanding the initialization order and hook priorities is critical for integrations.
Initialization Order
All classes are instantiated in rankforge_init() on plugins_loaded (priority 5):
text
1. RANKFORGE_License 12. RANKFORGE_Redirects
2. RANKFORGE_Core 13. RANKFORGE_Image_Seo
3. RANKFORGE_Analyzer 14. RANKFORGE_GSC
4. RANKFORGE_Meta_Templates 15. RANKFORGE_Local_Seo
5. RANKFORGE_Meta_Generator 16. RANKFORGE_AB_Testing
6. RANKFORGE_Internal_Links 17. RANKFORGE_Auto_Links
7. RANKFORGE_Schema 18. RANKFORGE_Site_Audit
8. RANKFORGE_Content_Scorer 19. RANKFORGE_Robots_Meta
9. RANKFORGE_Content_Optimizer 20. RANKFORGE_Sitemap
10. RANKFORGE_Rest_Api 21. RANKFORGE_Robots_Txt
11. RANKFORGE_Dashboard 22. RANKFORGE_Video_SeoAdmin-only classes (RANKFORGE_Admin, RANKFORGE_License_Admin, RANKFORGE_Migration) load only when is_admin().
Safe Timing for Integration Code
php
add_action( 'plugins_loaded', function () {
if ( ! class_exists( 'RANKFORGE_Core' ) ) {
return;
}
// All RANKFORGE_* classes are now available
}, 10 ); // Priority 10 is after Rank Forge's priority 5
// Run custom code after Rank Forge finishes analyzing on save
add_action( 'save_post', function ( $post_id, $post, $update ) {
if ( ! class_exists( 'RANKFORGE_Analyzer' ) ) {
return;
}
$cached = RANKFORGE_Analyzer::instance()->get_cached( $post_id );
if ( $cached && (int) $cached->score < 50 ) {
wp_mail( get_option( 'admin_email' ), "Low SEO score on #{$post_id}",
"'{$post->post_title}' scored {$cached->score}." );
}
}, 25, 3 ); // Priority 25 runs after Rank Forge's 20—