Meta.php
986 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
44
45
46
47
48
<?php
namespace AIOSEO\Plugin\Common\Meta;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AIOSEO\Plugin\Common\Models;
/**
* Instantiates the Meta classes.
*
* @since 4.0.0
*/
class Meta {
/**
* Class constructor.
*
* @since 4.0.0
*/
public function __construct() {
$this->metaData = new MetaData();
$this->title = new Title();
$this->description = new Description();
$this->keywords = new Keywords();
$this->amp = new Amp();
$this->links = new Links();
add_action( 'delete_post', [ $this, 'deletePostMeta' ], 1000, 2 );
}
/**
* When we delete the meta, we want to delete our post model.
*
* @since 4.0.1
*
* @param integer $postId The ID of the post.
* @param WP_Post $post The post object.
* @return void
*/
public function deletePostMeta( $postId ) {
$aioseoPost = Models\Post::getPost( $postId );
if ( $aioseoPost->exists() ) {
$aioseoPost->delete();
}
}
}