This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwpseo-weight-loss.php
85 lines (64 loc) · 1.88 KB
/
wpseo-weight-loss.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
Plugin Name: WordPress SEO Weight Loss Program
Description: Lose some of the fat that comes from eating Yoast's spam sandwich.
Version: 1.0.1
Author: John Parris
Author URI: http://www.johnparris.com/
License: GPLv2
*/
function jp_wpseo_fat_slicer() {
// Only do this for users who don't have Editor capabilities
if ( ! current_user_can( 'edit_others_posts' ) ) {
add_action( 'add_meta_boxes', 'jp_remove_yoast_metabox', 99 );
add_filter( 'wp_before_admin_bar_render', 'jp_admin_bar_seo_cleanup' );
add_action( 'admin_menu', 'jp_admin_menu_cleanup' );
add_filter( 'manage_edit-post_columns', 'jp_remove_columns' );
add_filter( 'manage_edit-page_columns', 'jp_remove_columns' );
// add_filter( 'manage_edit-CPTNAME_columns', 'jp_remove_columns' ); // Replace CPTNAME with your custom post type name, for example "restaurants".
}
}
add_action( 'init', 'jp_wpseo_fat_slicer' );
/**
* Removes the WordPress SEO meta box from posts and pages
*
* @since 1.0.0
* @uses remove_meta_box()
*/
function jp_remove_yoast_metabox() {
$post_types = array( 'page', 'post' ); // add any custom post types here
foreach( $post_types as $post_type ) {
remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
}
}
/**
* Removes the SEO item from the admin bar
*
* @since 1.0.0
* @uses remove_menu
*/
function jp_admin_bar_seo_cleanup() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'wpseo-menu' );
}
/**
* Removes the extra columns on the post/page listing screens.
*
* @since 1.0.0
*/
function jp_remove_columns( $columns ) {
unset( $columns['wpseo-score'] );
unset( $columns['wpseo-title'] );
unset( $columns['wpseo-metadesc'] );
unset( $columns['wpseo-focuskw'] );
return $columns;
}
/**
* Removes the SEO menu item from the admin menu.
*
* @since 1.0.1
* @uses remove_menu-page()
*/
function jp_admin_menu_cleanup() {
remove_menu_page( 'wpseo_dashboard' );
}