1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
namespace YayMail\Integrations;
use YayMail\PostTypes\TemplatePostType; use YayMail\Utils\SingletonTrait;
/** * RankMath * * @method static RankMath get_instance() */ class RankMath { use SingletonTrait;
protected function __construct() {
if ( ! class_exists( 'RankMath' ) ) { return; }
add_action( 'init', [ $this, 'init' ], PHP_INT_MAX ); }
public function init() { $titles_settings = get_option( 'rank-math-options-titles', [] ); if ( empty( $titles_settings ) ) { return; }
$title_meta_key = 'pt_' . TemplatePostType::POST_TYPE . '_robots';
if ( empty( $titles_settings[ $title_meta_key ] ) ) { $titles_settings[ $title_meta_key ] = []; }
$titles_settings[ $title_meta_key ][] = 'noindex';
update_option( 'rank-math-options-titles', $titles_settings ); } }
|