0, 'status' => 'pending'); } public static function begin_login() { update_user_meta(get_current_user_id(), self::key(), array('step' => 0, 'status' => 'pending', 'show_once' => true)); } public static function show() { if (!current_user_can('manage_options') || !get_option('seoai_site_token', '')) return false; $state = self::state(); $automatic = !empty($state['show_once']); if ($automatic) { // Consume the welcome prompt once; ordinary Overview visits stay on the dashboard. $state['show_once'] = false; update_user_meta(get_current_user_id(), self::key(), $state); } return $automatic || (isset($_GET['welcome']) && $_GET['welcome'] === '1'); } public static function url($step = null) { $url = admin_url('admin.php?page=seo-ai-connector&welcome=1'); return $step === null ? $url : add_query_arg('step', $step, $url); } public static function handle() { if (!isset($_POST['ai4ranks_welcome_action'])) return; if (!current_user_can('manage_options') || !get_option('seoai_site_token', '')) wp_die('Please connect an administrator account first.', '', array('response' => 403)); if (!isset($_REQUEST['_wpnonce']) || !is_string($_REQUEST['_wpnonce'])) wp_die('Invalid security token.', '', array('response' => 403)); check_admin_referer('ai4ranks_welcome'); $action = is_string($_POST['ai4ranks_welcome_action']) ? sanitize_key(wp_unslash($_POST['ai4ranks_welcome_action'])) : ''; if (!in_array($action, array('next', 'skip', 'finish'), true)) wp_die('Invalid setup action.'); $step = isset($_POST['welcome_step']) && is_string($_POST['welcome_step']) ? filter_var(wp_unslash($_POST['welcome_step']), FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 4))) : false; if ($step === false || ($action === 'finish' && $step !== 4)) wp_die('Invalid setup step.'); if ($action === 'next' && $step === 2) { if (!isset($_POST['welcome_titles']) || !is_array($_POST['welcome_titles'])) wp_die('Invalid SEO settings.'); $fields = array( 'post_title_template' => isset($_POST['welcome_titles']['post_title_template']) && is_string($_POST['welcome_titles']['post_title_template']) ? sanitize_text_field(wp_unslash($_POST['welcome_titles']['post_title_template'])) : '', 'post_description_template' => isset($_POST['welcome_titles']['post_description_template']) && is_string($_POST['welcome_titles']['post_description_template']) ? sanitize_textarea_field(wp_unslash($_POST['welcome_titles']['post_description_template'])) : '', 'separator' => isset($_POST['welcome_titles']['separator']) && is_string($_POST['welcome_titles']['separator']) ? sanitize_text_field(wp_unslash($_POST['welcome_titles']['separator'])) : '', ); $settings = SEO_AI_Connector::get_instance()->sanitize_titles_settings($fields); update_option('ai4ranks_titles_settings', $settings); } $status = $action === 'skip' ? 'skipped' : ($action === 'finish' ? 'complete' : 'pending'); $next = min(4, $step + 1); update_user_meta(get_current_user_id(), self::key(), array('status' => $status, 'step' => $next)); wp_safe_redirect($status === 'pending' ? self::url($next) : admin_url('admin.php?page=seo-ai-connector')); exit; } public static function render() { $state = self::state(); $saved_step = isset($state['step']) && (is_int($state['step']) || is_string($state['step'])) ? filter_var($state['step'], FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 4))) : false; // Step links only select a view. Saving progress and settings requires the verified POST above. $requested_step = isset($_GET['step']) && is_string($_GET['step']) ? filter_var(wp_unslash($_GET['step']), FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 4))) : false; $step = $requested_step !== false ? $requested_step : ($saved_step !== false ? $saved_step : 0); $labels = array('Welcome', 'Your website', 'SEO essentials', 'Your workflow', 'Ready to begin'); $settings = wp_parse_args((array) get_option('ai4ranks_titles_settings', array()), array('post_title_template' => '{{post.title}} {{separator}} {{site.title}}', 'post_description_template' => '{{post.excerpt}}', 'separator' => '–')); $plugin = SEO_AI_Connector::get_instance(); $owns = $plugin->output_ownership() === 'ai4ranks_primary'; ?>
ai4ranksAccount linked

A GOOD START FOR YOUR WEBSITE

Make AI4Ranks yours.

A few focused steps to help you get started with your connected website.

STEP OF 5

Welcome to your next chapter.

Your account is connected. Now bring your website, content and SEO work together with a clear place to start.

From content to clear next steps.

Review what you publish, find opportunities with keywords, and choose which improvements go live.

  • Confirm your connected website.
  • Review the title and description templates you use.
  • Learn where to sync, review and improve your content.

Your website, connected.

These details come from WordPress and your linked AI4Ranks account.

Website
Address
Account
Plan
Published content
publish . ' posts · ' . (int) wp_count_posts('page')->publish . ' pages'); ?>

To change your website name or language, visit WordPress General Settings ↗.

Give your content a consistent starting point.

Review the templates for post titles and descriptions. Individual SEO values take priority when set.

Use {{post.title}}, {{site.title}}, {{separator}} and {{post.excerpt}} to build your templates.

A workflow that keeps you in control.

Start with your existing content, then expand as you need.

Sync & review content

Use “Sync to AI4RANKS” on Overview to send published content to your workspace. Review individual posts with Audit and Generate Meta.

Find your next topic

Use Keywords to explore suggestions and plan content around relevant searches.

Understand your visitors

Review Visitor Intelligence settings when you are ready to configure analytics and consent preferences for your website.

Content sync, SEO changes, visitor tracking and Partner Network participation are separate actions. This guide does not activate them.

Your next step starts here.

Your account is connected. Here is where your website stands today.

WORKSPACE
CONNECTED

Review WordPress search visibility ↗

Bring your next opportunity into focus.

Use your AI4Ranks workspace to review content, explore keywords and plan improvements for your connected website.

Explore my workspace ↗

YOUR NEXT STEP

Start with your published content.

Open Overview and select “Sync to AI4RANKS”. Then choose one post to audit and review its recommendations before applying changes.

You can revisit these settings or reopen the welcome guide from Overview.