Skip to content

Commit

Permalink
revert changes as some are still usable
Browse files Browse the repository at this point in the history
  • Loading branch information
senlin committed Feb 7, 2023
1 parent b822f37 commit b8fc2db
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 2 deletions.
58 changes: 56 additions & 2 deletions includes/class-so-clean-up-wp-seo-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,34 @@ private function settings_fields() {
'title' => __( 'Without further ado: Hide the bloat', 'so-clean-up-wp-seo' ),
//'description' => __( 'description' ),
'fields' => array(
array(
'id' => 'hide_ads',
'label' => __( 'Sidebar Ads', 'so-clean-up-wp-seo' ),
'description' => __( 'Hide the cartoon-style sidebar ads on almost all settings pages of the Yoast SEO plugin.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_ads'],
),
array(
'id' => 'hide_tagline_nag',
'label' => __( 'General > Dashboard tab > Problems box > <b>Tagline nag</b>', 'so-clean-up-wp-seo' ),
'description' => __( 'Hide Tagline nag that shows in the Problem Box of the Dashboard tab under General Settings.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_tagline_nag'],
),
array(
'id' => 'hide_robots_nag',
'label' => __( 'General > Dashboard tab > Problems box > <b>Robots nag</b>', 'so-clean-up-wp-seo' ),
'description' => __( 'Hide robots nag that shows as a "Huge SEO issue" in the Problem Box of the Dashboard tab under General Settings.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_robots_nag'],
),
array(
'id' => 'hide_upsell_notice',
'label' => __( 'General > Dashboard tab > Notifications box > <b>Upsell Notice</b>', 'so-clean-up-wp-seo' ),
'description' => __( 'Hide the Upsell Notice in the Notifications box that shows in the Notifications Box of the Dashboard tab under General Settings.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_upsell_notice'],
),
array(
'id' => 'hide_dashboard_problems_notifications',
'label' => __( 'General > Dashboard tab > <b>Problems/Notifications boxes</b>', 'so-clean-up-wp-seo' ),
Expand All @@ -197,6 +225,13 @@ private function settings_fields() {
),
'default' => $options['hide_dashboard_problems_notifications'],
),
array(
'id' => 'hide_crawl_settings',
'label' => __( 'Crawl Settings Tab', 'so-clean-up-wp-seo' ),
'description' => __( 'Hide the Crawl Settings tab.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_crawl_settings'],
),
array(
'id' => 'hide_upsell_admin_block',
'label' => __( 'Premium Upsell Admin Block', 'so-clean-up-wp-seo' ),
Expand All @@ -211,6 +246,20 @@ private function settings_fields() {
'type' => 'checkbox',
'default' => $options['hide_premium_submenu'],
),
array(
'id' => 'hide_post_deletion_premium_ad',
'label' => __( 'Post/Page/Taxonomy Deletion Premium Ad', 'so-clean-up-wp-seo' ),
'description' => __( 'Hides Post Deletion Premium Ad in edit Post/Page/Taxonomy screens.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_post_deletion_premium_ad'],
),
array(
'id' => 'hide_config_wizard',
'label' => __( 'Hide Configuration Wizard check', 'so-clean-up-wp-seo' ),
'description' => __( 'Hide the Configuration Wizard check that shows at the top of almost all Yoast SEO Settings screens.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['hide_config_wizard'],
),
array(
'id' => 'hide_imgwarning_nag',
'label' => __( 'Featured image nag', 'so-clean-up-wp-seo' ),
Expand Down Expand Up @@ -265,6 +314,13 @@ private function settings_fields() {
'type' => 'checkbox',
'default' => $options['hide_seo_settings_profile_page'],
),
array(
'id' => 'remove_primarycatfeat',
'label' => __( 'Primary category', 'so-clean-up-wp-seo' ),
'description' => __( 'Remove primary category feature.', 'so-clean-up-wp-seo' ),
'type' => 'checkbox',
'default' => $options['remove_primarycatfeat'],
),
array(
'id' => 'remove_adminbar',
'label' => __( 'SEO menu admin bar', 'so-clean-up-wp-seo' ),
Expand Down Expand Up @@ -307,8 +363,6 @@ private function settings_fields() {
'type' => 'checkbox',
'default' => $options['hide_ad_after_trashing_content'],
),
// New settings introduced for Yoast 20.x

),
);

Expand Down
45 changes: 45 additions & 0 deletions includes/class-so-clean-up-wp-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ public function so_cuws_remove_dashboard_widget() {
}
}

/**
* at some point Yoast SEO has introduced "Primary Category Feature"
* This function removes this "feature"
*
* @since v3.6.0
*/
public function so_cuws_remove_primary_category_feature() {

if ( ! empty( $this->options['remove_primarycatfeat'] ) ) {

add_filter( 'wpseo_primary_term_taxonomies', '__return_empty_array' );

}
}

/**
* Remove Search Console
*
Expand Down Expand Up @@ -340,6 +355,21 @@ public function so_cuws_hide_visibility_css() {

echo '<style media="screen" id="so-hide-seo-bloat" type="text/css">';

// sidebar ads
if ( ! empty( $this->options['hide_ads'] ) ) {
echo '#sidebar-container.wpseo_content_cell{display:none!important;}'; // @since v1.0.0; @modified v3.4.1
}

// tagline nag
if ( ! empty( $this->options['hide_tagline_nag'] ) ) {
echo '#wpseo-dismiss-tagline-notice{display:none;}'; // @since v2.6.0 hide tagline nag
}

// robots nag
if ( ! empty( $this->options['hide_robots_nag'] ) ) {
echo '#wpseo-dismiss-blog-public-notice,#wpseo_advanced .error-message{display:none;}'; // @since v2.0.0 hide robots nag; @modified v2.5.4 to add styling via the options and not globally.
}

// hide upsell notice in Yoast SEO Dashboard
if ( ! empty( $this->options['hide_upsell_notice'] ) ) {
echo '#yoast-warnings #wpseo-upsell-notice,#yoast-additional-keyphrase-collapsible-metabox,.wpseo-keyword-synonyms,.wpseo-multiple-keywords,.switch-container.premium-upsell,.yoast-settings-section-upsell,.yoast-settings-section-disabled{display:none !important;}'; // @since v2.5.3 hide upsell notice in Yoast SEO Dashboard; @modified v2.5.4 improved to remove entire Notification box in the main Dashboard; @modified v2.6.0 only hide this notice; @modified 3.13.4 hide additional keyphrase "option" from metabox as it is ad for premium too; @modified 3.14.12 hide "Unlock with Premium" button and options.
Expand All @@ -350,12 +380,22 @@ public function so_cuws_hide_visibility_css() {
echo '.yoast_premium_upsell,.yoast_premium_upsell_admin_block,#wpseo-local-seo-upsell,div[class^="SocialUpsell__PremiumInfoText"],.fBWRwy{display:none}'; // @since v3.1.0; @modified v3.11.1; @modified v3.13.2; @modified v3.14.1; @modified to include SEO Analysis dropdown upsell v3.14.4
}

// hide crawl settings tab
if ( ! empty( $this->options['hide_crawl_settings'] ) ) {
echo '#wpseo-tabs #crawl-settings-tab{display: none;}'; // @since v3.14.10
}

// hide "Premium" submenu in its entirety
// include hiding "Workouts" submenu in its entirety
if ( ! empty( $this->options['hide_premium_submenu'] ) ) {
echo 'li#toplevel_page_wpseo_dashboard>ul>li:nth-child(6),li#toplevel_page_wpseo_dashboard>ul>li:nth-child(7),li#toplevel_page_wpseo_dashboard>ul>li:nth-child(8){display:none;}'; // @since v3.6.0 hide "Premium" submenu in its entirety; @modified v3.12.0 decrease with 1, due to Search Console submenu being removed; @since 3.14.8 include hiding "Workouts" submenu in its entirety @since 3.14.10 include hiding "Redirects" submenu in its entirety; @since 3.14.13 Yoast SEO swapped menu items around
}

// hide Post/Page/Taxonomy Deletion Premium Ad
if ( ! empty( $this->options['hide_post_deletion_premium_ad'] ) ) {
echo 'body.edit-php .yoast-alert.notice.notice-warning,body.edit-tags-php .yoast-alert.notice.notice-warning{display:none;}'; // @since v3.8.0
}

// Problems/Notification boxes
if ( ! empty( $this->options['hide_dashboard_problems_notifications'] ) ) {
if ( in_array( 'problems', $this->options['hide_dashboard_problems_notifications'] ) ) {
Expand All @@ -376,6 +416,11 @@ public function so_cuws_hide_visibility_css() {
echo '#wpadminbar .yoast-issue-counter,#toplevel_page_wpseo_dashboard .wp-menu-name .update-plugins{display:none;}'; // @since v2.3.0 hide issue counter from adminbar and plugin menu sidebar; @modified v3.2.1 to remove orange background that shows again; @modified v3.13.5 fix issue 81
}

// hide Configuration Wizard on every screen in the Yoast admin
if ( ! empty( $this->options['hide_config_wizard'] ) ) {
echo '.yoast-alerts .yoast-container__configuration-wizard{display:none;}'; // @since v3.6.0 hide Configuration Wizard
}

/*
* admin columns
* @since v2.0.0 remove seo columns one by one
Expand Down

0 comments on commit b8fc2db

Please sign in to comment.