forked from salcode/yoast-seo-eliminate-notifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoast-seo-eliminate-notifications.php
53 lines (47 loc) · 1.66 KB
/
yoast-seo-eliminate-notifications.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
<?php
/**
* Plugin Name: Yoast SEO Eliminate Notifications
* Plugin URI: https://salferrarello.com/yoast-seo-eliminate-notifications/
* Description: Suppresses the Yoast SEO messages to "Take the Tour" and see "What's New". Tested on Yoast SEO 3.2.3
* Version: 0.2.0
* Author: Sal Ferrarello
* Author URI: https://salferrarello.com/
* Text Domain: yoast-seo-eliminate-notifications
* Domain Path: /languages
*
* @package yoast-seo-eliminate-notifications
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
add_filter( 'get_user_metadata', 'salcode_yoast_seo_eliminate_notifications', 10, 4 );
/**
* Modify Yoast SEO user meta values
*
* @param null|array|string $value The value get_metadata() should return - a single metadata value,
* or an array of values.
* @param int $object_id Object ID.
* @param string $meta_key Meta key.
* @param bool $single Whether to return only the first value of the specified $meta_key.
*
* @return null|string returns the override value for Yoast SEO meta_keys and the original
* value (e.g. null) for all other meta_keys
*/
if ( ! function_exists( 'salcode_yoast_seo_eliminate_notifications' ) ) {
function salcode_yoast_seo_eliminate_notifications( $value, $object_id, $meta_key, $single ) {
/**
* Suppress the tour message popup.
*/
if ( 'wpseo_ignore_tour' === $meta_key ) {
return '1';
}
/**
* Suppress the After Update Notice, Find Out What's New admin notice.
*/
if ( 'wpseo_seen_about_version' === $meta_key ) {
return '9999.0.0';
}
return $value;
}
}