This section covers everything you need to begin integrating your theme or plugin with SEO Forge. You will learn how to detect the plugin, check versions, gate features by license tier, and access the internal class instances.
Shared Forge Suite Diagnostics
When SEO Forge is active, the shared Forge Suite > Setup & Health panel is available in WordPress admin. The diagnostic AJAX action is forge_suite_health_check; the guided-action endpoint is forge_suite_health_repair. Both require manage_options and the localized forge_suite_health_check nonce. The response returns diagnostics for active Forge plugins, local license records, credits widget readiness, Avakode API /health, permalinks, migration/integration source plugins such as Yoast, Rank Math, AIOSEO, WooCommerce, and Elementor, recommendations, and recent run history. Allowed repair actions are narrow: refresh permalink rules, refresh saved credit balances, generate a redacted support package, or clear diagnostic history. The panel does not run audits, call AI endpoints, spend credits, import SEO data, write Google settings, or change license/Freemius state.
Checking if SEO Forge is Active
Before calling any SEO Forge API, you must verify the plugin is loaded. The recommended approach depends on where your code runs:
// Basic check — works anywhere after plugins_loaded
if ( class_exists( 'SEOFORGE_Core' ) ) {
// SEO Forge is active and loaded
}
// Version check — useful when your integration depends on a specific API
if ( defined( 'SEOFORGE_VERSION' ) && version_compare( SEOFORGE_VERSION, '1.0.0', '>=' ) ) {
// Version 1.0.0 or higher — safe to use all documented APIs
}
// Full guard pattern for theme functions.php or plugin bootstrap
add_action( 'plugins_loaded', function () {
if ( ! class_exists( 'SEOFORGE_Core' ) ) {
return; // SEO Forge not installed or not active
}
// Safe to register hooks that interact with SEO Forge
add_filter( 'robots_txt', 'my_custom_robots_rules', 25, 2 );
add_action( 'wp_head', 'my_extra_schema_output', 8 );
}, 10 ); // priority 10 runs after SEO Forge's priority 5The timing matters because SEO Forge initializes on plugins_loaded at priority 5. Any code that depends on SEO Forge classes should run at priority 6 or later.
Available Constants
SEO Forge defines the following constants during bootstrap. Use them for building file paths, referencing assets, or checking versions:
SEOFORGE_VERSION // '1.0.0' — current plugin version string
SEOFORGE_DIR // '/path/to/wp-content/plugins/seoforge/' — absolute filesystem path with trailing slash
SEOFORGE_URL // 'https://example.com/wp-content/plugins/seoforge/' — URL with trailing slash
SEOFORGE_BASENAME // 'seoforge/seoforge.php' — plugin basename for use with plugin_dir_path(), etc.Example usage in a companion plugin:
// Enqueue a script that depends on SEO Forge admin JS
add_action( 'admin_enqueue_scripts', function () {
if ( ! defined( 'SEOFORGE_VERSION' ) ) {
return;
}
wp_enqueue_script(
'my-seoforge-addon',
plugin_dir_url( __FILE__ ) . 'js/addon.js',
[ 'seoforge-admin' ],
'1.0.0',
true
);
wp_localize_script( 'my-seoforge-addon', 'myAddon', [
'seoforgeDir' => SEOFORGE_DIR,
'seoforgeUrl' => SEOFORGE_URL,
'version' => SEOFORGE_VERSION,
] );
} );License and Feature Gating
Features are gated by license tier. Always check availability before calling PRO methods, otherwise you will get a fatal error or unexpected behavior:
// Check if PRO is active (returns bool)
if ( SEOFORGE_License::is_pro() ) {
// All PRO features available
}
// Check a specific feature by key (returns bool)
if ( SEOFORGE_License::instance()->can( 'redirects' ) ) {
$redirects = SEOFORGE_Redirects::instance();
$all = $redirects->get_all();
}
// Get current plan as string: 'free', 'pro', or 'trial'
$plan = SEOFORGE_License::get_plan();
// Conditional UI rendering based on plan
if ( SEOFORGE_License::get_plan() === 'free' ) {
echo '<p>Upgrade to PRO for redirect management.</p>';
} else {
// Render redirect management UI
}can():
| Key | Feature | Tier |
|---|---|---|
meta_generator | AI Meta Generation | PRO, Trial |
content_brief | AI Content Brief | PRO, Trial |
schema_builder | Schema Builder | PRO, Trial |
site_audit | Site Audit | PRO, Trial |
internal_links | Internal Link Suggestions | PRO, Trial |
auto_links | Auto Internal Links | PRO, Trial |
gsc | Google Search Console | PRO, Trial |
ab_testing | A/B Testing | PRO, Trial |
image_seo | Image SEO | PRO, Trial |
content_optimizer | Content Optimizer | PRO, Trial |
redirects | Redirects Manager | PRO, Trial |
local_seo | Local SEO | PRO, Trial |
video_seo | Video SEO | PRO, Trial |
Example: building a custom admin page that conditionally shows features:
add_action( 'admin_menu', function () {
if ( ! class_exists( 'SEOFORGE_License' ) ) {
return;
}
add_submenu_page(
'seoforge',
'My Addon',
'My Addon',
'manage_options',
'my-seoforge-addon',
function () {
$license = SEOFORGE_License::instance();
echo '<div class="wrap"><h1>My SEO Addon</h1>';
if ( $license->can( 'gsc' ) ) {
echo '<h2>Search Console Data</h2>';
$gsc = SEOFORGE_GSC::instance();
if ( $gsc->is_connected() ) {
$rankings = $gsc->get_keyword_rankings( 28, 10 );
// Render rankings table...
}
} else {
echo '<p>Upgrade to PRO to see Search Console data.</p>';
}
echo '</div>';
}
);
} );Singleton Pattern
All SEO Forge classes follow the singleton pattern. Never instantiate them with new — always use ::instance():
$analyzer = SEOFORGE_Analyzer::instance();
$schema = SEOFORGE_Schema::instance();
$redirects = SEOFORGE_Redirects::instance();
$gsc = SEOFORGE_GSC::instance();
$templates = SEOFORGE_Meta_Templates::instance();
$meta_gen = SEOFORGE_Meta_Generator::instance();
$links = SEOFORGE_Internal_Links::instance();
$auto_links = SEOFORGE_Auto_Links::instance();
$scorer = SEOFORGE_Content_Scorer::instance();
$optimizer = SEOFORGE_Content_Optimizer::instance();
$sitemap = SEOFORGE_Sitemap::instance();
$robots = SEOFORGE_Robots_Meta::instance();
$robots_txt = SEOFORGE_Robots_Txt::instance();
$image_seo = SEOFORGE_Image_Seo::instance();
$local = SEOFORGE_Local_Seo::instance();
$video = SEOFORGE_Video_Seo::instance();
$ab = SEOFORGE_AB_Testing::instance();
$dashboard = SEOFORGE_Dashboard::instance();You can safely call ::instance() multiple times — it always returns the same object.
—