Brooms Against Wall

5-minute read

Modifying the ClassicPress Head Section

The ClassicPress head section contains many helpful tags. Do you need them all? Learn how to remove unneeded tags from the head section.

Have you ever looked at your page source and wondered, ‘What are all these tags in the ClassicPress head section?” If so, lucky you! This quick guide reveals the general purpose of the various “extra” tags and provides easy solutions for removing each of them. These simple code snips will make a great addition to your site-specific utility plugins. If you don’t need explanations, the code snips are compiled at the end and here’s your jump.

Really Simple Discovery Tag

Example: <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://yoursite.com/xmlrpc.php?rsd" />

If you aren’t using XML-RPC, you don’t need the “Really Simple Discovery” (RSD) tag. The following code removes it from the head section.

Windows Live Writer Manifest Tag

Example: <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://yoursite.com/wp-includes/wlwmanifest.xml" />

If you aren’t composing posts with Windows Live Writer (WLW), this tag can go. As a safeguard, be sure to consult with all those who author posts on your site before removing this tag. The following code removes the WLW manifest tag from the head section.

Emoji Tags

Example: <link rel='dns-prefetch' href='//twemoji.classicpress.net' />

If you aren’t using emoji on your site, you can disable it entirely. The following code removes the JavaScript and CSS for emojis as well as the DNS prefetch of the emoji domain from the head section.

Site Generator Tag

Example: <meta name="generator" content="WordPress 4.9.12 (compatible; ClassicPress 1.1.1)">

If you prefer to not show the ClassicPress version (and WordPress version it is based on,) the following code will remove the tag from the head section.

Primary RSS Feed Tags

Example: <link rel="alternate" type="application/rss+xml" title="Basic Posts Feed" href="https://yoursite.com/feed/" />

Example: <link rel="alternate" type="application/rss+xml" title="Overall Comments Feed" href="https://yoursite.com/comments/feed/" />

The RSS feed tags allow your RSS feeds to be more easily discovered. The following code removes the general feed tags from the head section.

Post-Specific RSS Comment Feed Tags

Example: <link rel="alternate" type="application/rss+xml" title="Specific Post Comments Feed" href="https://yoursite.com/hello-world/feed/" />

If you don’t need RSS feeds for the comments of each specific post, the following code will remove the tag from the head section.

Post Relation Tags

Example: <link rel='prev' title='Hello world!' href='https://yoursite.com/hello-world/' />

Example: <link rel='next' title='One more post' href='https://yoursite.com/one-more-post/' />

For sequential items (think posts, not pages) tags are injected to indicate the URL of the previous and next posts. These tags can help search engines (think Google) to understand that the items are in a sequence, so, only remove these tags if you don’t care to make this distinction. The following code will remove these tags from the head section.

Remote API Tag

Example: <link rel='https://api.w.org/' href='https://yoursite.com/wp-json/' />

While I’m not entirely certain of the full purpose of this tag, I believe it can be used for tracking purposes. Note that removing this tag does not disable JSON on your site. The following code will remove the tag from the head section. If you know more about the purpose of this tag, please let me know in the comments!

oEmbed Discovery Tags

Example: <link rel="alternate" type="application/json+oembed" href="https://yoursite.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fyoursite.com%2Fheres-a-new-post%2F" />

Example: <link rel="alternate" type="text/xml+oembed" href="https://yoursite.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fyoursite.com%2Fheres-a-new-post%2F&#038;format=xml" />

These are another couple of tags that I’m not really sure about. Nonetheless, the following code will remove the tags from the head section. If you know more about the purpose of these tags, please let me know in the comments.

Shortlink tag

Example: <link rel='shortlink' href='https://yoursite/?p=1' />

When you have short URLs enabled, a tag is injected into the head section that indicates the direct URL to the page by its post id. The following code will remove the tag from the head section.

Pingback Tag

Example: <link rel="pingback" href="https://yoursite.com/xmlrpc.php">

The pingback-related tag is usually added by the theme. Check the functions.php file and, most likely, you can comment-out or remove the line that generates the tag.


Complete Code Example

As promised, here are all the code snips from above, complete with comments. Don’t forget that the pingback tag is probably hard-coded in your theme.

Wrapping Up

The ClassicPress head section contains many helpful tags. Some tags give search engines additional context, while other tags enable various features or support. It’s fair to say that not every site is going to need every tag. That said, it’s important to not take the above code and apply it wholesale simply because it has been packaged neatly. Take a few minutes to (at the very least) read the comments – after all, it would be a shame if you removed something on which you actually relied!

What do you think?

Did you realize the ClassicPress head section was so highly customizable? Or, did you think you were stuck with what you got? Curious to know: did you learn any new tricks? I’d love to hear your thoughts – let me know in the comments!

2 comments on “Modifying the ClassicPress Head Section”

  1. A commenter said:

    Re: Remote API Tag
    This is the REST API. If you don’t use it (or no plugin is using it), it’s probably best to disable it. But, as the plugin “Disable WP REST API” says: you can disable for visitors and remove the links for everyone. In other words, removing the link is just one third of the total.

    Re: oEmbed Discovery Tags
    Embeds work in two directions, but things that you embed are cached, so it’s lopsided. The plugin “Disable Embeds” does a little more than remove the link, but it’s written by a core committer.

    Re: Pingback Tag
    The pingback option in Discussion Settings is global for all new posts, but each post can have its own setting. Yes, the theme outputs this, but only to make the core option work. The plugin “Remove & Disable XML-RPC Pingback” advises not to disable XML-RPC because of plugins like JetPack that can be using it, so it disables just part of it.

Leave a Reply

Your email address will not be published. Required fields are marked *

shares