',
''
);
}
return $message;
},
10,
2
);
add_filter(
'adminoptim_notification_banner_content_' . self::SECTION_ID,
static function (): array {
$content = [
[
'message' => sprintf(
/* translators: 1: Opening strong tag, 2: Closing strong tag. */
__( '%1$sBetter control over metadata, indexing, sitemaps, redirects and everyday SEO tasks.%2$s Leave a ★★★★★ review on WordPress.org and help others manage SEO without unnecessary complexity.', 'admin-optimizer' ),
'',
''
),
'cta_type' => 'review',
],
[
'message' => sprintf(
/* translators: 1: Opening strong tag, 2: Closing strong tag. */
__( '%1$sHaving issues with Admin Optimizer SEO tools?%2$s', 'admin-optimizer' ),
'',
''
),
'cta_type' => 'support',
],
];
return $content[ wp_rand( 0, 1 ) ];
},
);
}
/**
* Disable Frontend archive pages
*
* @return void
*/
public function disable_frontend_pages() {
if ( ! is_admin() ) {
global $wp_query;
$set_404 = false;
if ( Module_Registry::is_enabled( 'disable_category_archive' ) && is_category() ) {
$set_404 = true;
} elseif ( Module_Registry::is_enabled( 'disable_tag_archive' ) && is_tag() ) {
$set_404 = true;
} elseif ( Module_Registry::is_enabled( 'disable_author_archive' ) && is_author() ) {
$set_404 = true;
} elseif ( Module_Registry::is_enabled( 'disable_date_archive' ) && is_date() ) {
$set_404 = true;
}
if ( $set_404 ) {
$wp_query->set_404();
}
}
}
/**
* Ordinary module IDs this Section owns, mapped to their navigation labels.
*
* @return array
*/
protected function section_nav_modules(): array {
return [
'seo_manager' => 'SEO Manager',
'xml_sitemap' => 'XML Sitemap & Google News Sitemap',
'redirect_manager' => 'Redirect Manager',
'ads_robots_txt' => 'Robots.txt & Ads.txt',
];
}
/**
* Section-owned "SEO Controls" presentation group of lightweight
* SECTION_FEATURE capabilities.
*
* @return array{label:string,description:string,members:array}
*/
protected function section_feature_group(): ?array {
return [
'label' => __( 'SEO Controls', 'admin-optimizer' ),
'description' => __( 'Control how WordPress content, archives, and URLs are exposed to search engines and visitors.', 'admin-optimizer' ),
'members' => [
'disable_category_archive',
'disable_tag_archive',
'disable_author_archive',
'disable_date_archive',
],
];
}
}