SeoAnalysis.php
929 Bytes
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
42
43
<?php
namespace AIOSEO\Plugin\Common\Admin;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handles all admin code for the SEO Analysis menu.
*
* @since 4.2.6
*/
class SeoAnalysis {
/**
* Class constructor.
*
* @since 4.2.6
*/
public function __construct() {
add_action( 'save_post', [ $this, 'bustStaticHomepageResults' ], 10, 1 );
}
/**
* Busts the SEO Analysis for the static homepage when it is updated.
*
* @since 4.2.6
*
* @param int $postId The post ID.
* @return void
*/
public function bustStaticHomepageResults( $postId ) {
if ( ! aioseo()->helpers->isStaticHomePage( $postId ) ) {
return;
}
aioseo()->internalOptions->internal->siteAnalysis->score = 0;
aioseo()->internalOptions->internal->siteAnalysis->results = null;
aioseo()->core->cache->delete( 'analyze_site_code' );
aioseo()->core->cache->delete( 'analyze_site_body' );
}
}