class-premium-prominent-words-registration.php
2.95 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* @package WPSEO\Admin
*/
/**
* Registers the prominent words as a taxonomy.
*/
class WPSEO_Premium_Prominent_Words_Registration implements WPSEO_WordPress_Integration {
const TERM_NAME = 'yst_prominent_words';
/**
* {@inheritdoc}
*/
public function register_hooks() {
add_action( 'init', array( $this, 'register' ), 0 );
}
/**
* Registers the prominent words taxonomy.
*/
public function register() {
register_taxonomy( self::TERM_NAME, array( 'post', 'page' ), $this->get_args() );
}
/**
* Retrieves the labels for the taxonomy.
*
* @return array The labels for the taxonomy.
*/
private function get_labels() {
return array(
'name' => _x( 'Prominent words', 'Taxonomy General Name', 'wordpress-seo-premium' ),
'singular_name' => _x( 'Prominent word', 'Taxonomy Singular Name', 'wordpress-seo-premium' ),
'menu_name' => __( 'Prominent words', 'wordpress-seo-premium' ),
'all_items' => __( 'All prominent words', 'wordpress-seo-premium' ),
'new_item_name' => __( 'New prominent word', 'wordpress-seo-premium' ),
'add_new_item' => __( 'Add new prominent word', 'wordpress-seo-premium' ),
'edit_item' => __( 'Edit prominent word', 'wordpress-seo-premium' ),
'update_item' => __( 'Update prominent word', 'wordpress-seo-premium' ),
'view_item' => __( 'View prominent word', 'wordpress-seo-premium' ),
'separate_items_with_commas' => __( 'Separate prominent words with commas', 'wordpress-seo-premium' ),
'add_or_remove_items' => __( 'Add or remove prominent words', 'wordpress-seo-premium' ),
'choose_from_most_used' => __( 'Choose from the most used', 'wordpress-seo-premium' ),
'popular_items' => __( 'Popular prominent words', 'wordpress-seo-premium' ),
'search_items' => __( 'Search prominent words', 'wordpress-seo-premium' ),
'not_found' => __( 'Not Found', 'wordpress-seo-premium' ),
'no_terms' => __( 'No prominent words', 'wordpress-seo-premium' ),
'items_list' => __( 'Prominent words list', 'wordpress-seo-premium' ),
'items_list_navigation' => __( 'Prominent words list navigation', 'wordpress-seo-premium' ),
);
}
/**
* Retrieves the arguments for the taxonomy registration.
*
* @return array The arguments for the registration to WordPress.
*/
private function get_args() {
$args = array(
'labels' => $this->get_labels(),
'hierarchical' => false,
'public' => false,
'show_ui' => false,
'show_admin_column' => false,
'show_in_nav_menus' => false,
'show_tagcloud' => false,
'show_in_rest' => true,
);
if ( defined( 'WPSEO_DEBUG' ) && WPSEO_DEBUG ) {
$args['show_ui'] = true;
}
return $args;
}
}