-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelevant-density-optimizer.php
59 lines (52 loc) · 1.65 KB
/
relevant-density-optimizer.php
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
<?php
/**
* Plugin Name: Relevant Density Optimizer
* Description: Highlight relevant terms in Gutenberg editor and optimize density for SEO.
* Author: Infinitnet
* Author URI: https://infinitnet.io/
* Plugin URI: https://infinitnet.io/relevant-density-optimizer/
* Update URI: https://github.com/infinitnet/relevant-density-optimizer
* Version: 1.7.2
* License: GPLv3
* Text Domain: relevant-density-optimizer
*/
namespace Infinitnet\RDO;
if (!defined('ABSPATH')) {
exit;
}
define('RDO_VERSION', '1.7.2');
function rdo_enqueue_block_editor_assets() {
if (!wp_script_is('rdo-plugin-js', 'enqueued')) {
wp_enqueue_script(
'rdo-plugin-js',
plugin_dir_url(__FILE__) . 'rdo.js',
array(
'wp-plugins',
'wp-editor',
'wp-element',
'wp-data',
'wp-compose',
'wp-components',
'wp-blocks',
'wp-i18n',
'wp-dom-ready'
),
RDO_VERSION,
true
);
}
wp_enqueue_style('rdo-plugin-css', plugin_dir_url(__FILE__) . 'rdo.css', array(), RDO_VERSION);
}
function rdo_register_meta() {
register_meta('post', '_important_terms', array(
'show_in_rest' => true,
'single' => true,
'type' => 'string',
'auth_callback' => function() {
return current_user_can('edit_posts');
},
'sanitize_callback' => 'sanitize_textarea_field'
));
}
add_action('enqueue_block_editor_assets', __NAMESPACE__ . '\\rdo_enqueue_block_editor_assets');
add_action('init', __NAMESPACE__ . '\\rdo_register_meta');