# adminify/2.0.4/Inc/Admin/Options/Tweaks_Head.php

Adminify – White Label, Admin Menu Editor, Login Customizer, version 2.0.4. 278 lines.

- Page: https://pluginprobe.com/plugins/adminify/2.0.4/code/Inc/Admin/Options/Tweaks_Head.php
- Raw: https://pluginprobe.com/plugins/adminify/2.0.4/raw/Inc/Admin/Options/Tweaks_Head.php
- Modified: 2022-03-04T14:16:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/adminify/2.0.4/code/Inc/Admin/Options/Tweaks_Head.php#L10-L20`.

```php
<?php

namespace WPAdminify\Inc\Admin\Options;

use WPAdminify\Inc\Utils;
use WPAdminify\Inc\Admin\AdminSettingsModel;

if (!defined('ABSPATH')) {
    die;
} // Cannot access directly.

class Tweaks_Head extends AdminSettingsModel
{
    public function __construct()
    {
        $this->tweaks_head_settings();
    }

    public function get_defaults()
    {
        return [
            'generator_wp_version'             => false,
            'remove_wc_generator'              => false,
            'remove_revslider_generator'       => false,
            'remove_visual_composer_generator' => false,
            'remove_wpml_generator'            => false,
            'remove_yoast_generator'           => false,
            'remove_version_strings'           => false,
            'remove_dashicons'                 => false,
            'remove_link_url'                  => false,
            'remove_wlwmanifest'               => false,
            'remove_dns_prefetch'              => false,
            'remove_rsd'                       => false,
            'remove_shortlink'                 => false,
            'remove_canonical'                 => false,
            'remove_emoji'                     => false,
            'remove_prev_next'                 => false,
            'remove_recentcomments'            => false,
            'disable_xmlrpc'                   => false
        ];
    }


    /**
     * Tweaks: Head Fields
     *
     * @return void
     */
    public function tweaks_head_fields(&$head_fields)
    {

        $head_fields[] = array(
            'type'    => 'subheading',
            'content'   => Utils::adminfiy_help_urls(
                __('Remove unncessary links, scripts and styles from head section.', WP_ADMINIFY_TD),
                'https://wpadminify.com/kb/wp-adminify-tweaks/',
                'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
                'https://www.facebook.com/groups/jeweltheme',
                'https://wpadminify.com/support/'
            )
        );

        $head_fields[] = array(
            'id'         => 'generator_wp_version',
            'type'       => 'switcher',
            'title'      => __('Remove Generator Version', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove WordPress Generator WordPress Version from Frontend and RSS Feed', WP_ADMINIFY_TD),
            'label'      => __('This meta tag just shows your WordPress version. You can remove it for security reasons and keep your head section clean.', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
            'default'    => $this->get_default_field('generator_wp_version'),
        );

        $head_fields[] = array(
            'id'         => 'remove_wc_generator',
            'type'       => 'switcher',
            'title'      => __('Remove WooCommerce Generator Meta', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove "<meta name="generator" content="WooCommerce x.x.x" />" from head section', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_revslider_generator',
            'type'       => 'switcher',
            'title'      => __('Remove Revolution Slider Generator Meta', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove "<meta name="generator" content="Revolution Slider x.x.x" />" from head section', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_visual_composer_generator',
            'type'       => 'switcher',
            'title'      => __('Remove Visual Composer Generator Meta', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove "<meta name="generator" content="Visual Composer x.x.x" />" from head section', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_wpml_generator',
            'type'       => 'switcher',
            'title'      => __('Remove WPML Generator Meta', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove "<meta name="generator" content="Visual Composer x.x.x" />" from head section', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_yoast_generator',
            'type'       => 'switcher',
            'title'      => __('Remove All Yoast HTML Comments', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove Yoast HTML Comments', WP_ADMINIFY_TD),
            'label'      => __('Remove message - "This site is optimized with the Yoast WordPress SEO plugin" generated by Yoast', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_version_strings',
            'type'       => 'switcher',
            'title'      => __('Remove Version from Style and Script', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove Version Number from Styles/Scripts', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_dashicons',
            'type'       => 'switcher',
            'title'      => __('Remove Dashicons', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove Dashicons from Admin Bar for non logged in users', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_link_url',
            'type'       => 'switcher',
            'title'      => __('Remove Index Link', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove "<link rel=\'index\'..." from head section', WP_ADMINIFY_TD),
            'label'      => 'Remove Homepage Index Link',
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_wlwmanifest',
            'type'       => 'switcher',
            'title'      => __('Remove WLW Manifest Link', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove "<link rel=\'wlwmanifest\'..." from head section', WP_ADMINIFY_TD),
            'label'      => 'WLW Manifest Link adds support for Windows Live Writer app. If you are not using this app you can remove this link.',
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_dns_prefetch',
            'type'       => 'switcher',
            'title'      => __('Remove WP.org DNS Prefetch', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove &lt;link rel=&quot;dns-prefetch&quot; href=&quot;http://www.yourdomain.com/&quot;&gt; from head section', WP_ADMINIFY_TD),
            'label'      => __('If all of your resources has the same domain yo can disable forcing DNS lookup of specific hostnames', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_rsd',
            'type'       => 'switcher',
            'title'      => __('Remove RSD Link (EditURI Link)', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove "<link rel=\'EditURI\'..." from head section', WP_ADMINIFY_TD),
            'label'      => __('RSD (Real Simple Discovery) is the mechanism used by XML-RPC clients. Also this mechanism can be used by spammers. If do not use this clients with your site, you can remove it.', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_shortlink',
            'type'       => 'switcher',
            'title'      => __('Remove Shortlink', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove "<link rel=\'shortlink\'..." from head section', WP_ADMINIFY_TD),
            'label'      => __('This meta tag just shows short link (not canonical link) to your posts. You can remove it.', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_canonical',
            'type'       => 'switcher',
            'title'      => __('Remove Canonical URL', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove &lt;link rel="canonical" href="http://www.site.com/some-url" /&gt; from head section', WP_ADMINIFY_TD),
            'label'      => 'Remove Canonical URL. Details: https://support.google.com/webmasters/answer/139066?hl=en',
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_emoji',
            'type'       => 'switcher',
            'title'      => __('Remove Emoji Styles and Scripts', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove Emoji styles and scripts from head section', WP_ADMINIFY_TD),
            'label'      => __('If you are not using emoji smiles on your site you can disable this feature and keep your head section clean.', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_prev_next',
            'type'       => 'switcher',
            'title'      => __('Remove Prev/Next Links', WP_ADMINIFY_TD),
            'subtitle'   => esc_html__('Remove "<link rel=\'prev\'..." and "<link rel=\'next\'..." from head section', WP_ADMINIFY_TD),
            'label'      => 'This is links to the next and previous post that actually not used. You can remove it and keep your head section clean.',
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'remove_recentcomments',
            'type'       => 'switcher',
            'title'      => __('Remove Hardcoded Styles for Recent Comments', WP_ADMINIFY_TD),
            'subtitle'   => __('Remove styles for ".recentcomments a" from head section', WP_ADMINIFY_TD),
            'label'      => __('This is hard coded CSS for recent comments widget. You can remove it and keep your head section clean.', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );

        $head_fields[] = array(
            'id'         => 'disable_xmlrpc',
            'type'       => 'switcher',
            'title'      => __('Disable XML-RPC', WP_ADMINIFY_TD),
            'label'      => __('Use for WordPress APP, Trackbacks and pingbacks and JetPack Plugin.', WP_ADMINIFY_TD),
            'text_on'    => __('Yes', WP_ADMINIFY_TD),
            'text_off'   => __('No', WP_ADMINIFY_TD),
            'text_width' => 80,
        );
    }

    public function tweaks_head_settings()
    {

        if (!class_exists('ADMINIFY')) {
            return;
        }

        $head_fields = [];
        $this->tweaks_head_fields($head_fields);

        \ADMINIFY::createSection(
            $this->prefix,
            array(
                'title'  => __('Head', WP_ADMINIFY_TD),
                'parent' => 'tweaks_performance',
                'icon'   => 'fas fa-newspaper',
                'class'  => 'wp-adminify-two-columns aminify-title-width-40',
                'fields' => $head_fields
            )
        );
    }
}

```
