{"id":3092,"date":"2015-07-23T15:50:17","date_gmt":"2015-07-23T10:20:17","guid":{"rendered":"http:\/\/topleaguetech.com\/?p=3092"},"modified":"2018-06-20T20:58:27","modified_gmt":"2018-06-20T15:28:27","slug":"optimize-wordpress-install","status":"publish","type":"post","link":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/","title":{"rendered":"8 Smart Tweaks for a Better WordPress Blog"},"content":{"rendered":"

Building a self-hosted WordPress website is easy but, as a WordPress developer, you should know how to make your installation safe and secure so you can protect it from potential hackers.\u00a0Even as the team at WordPress is constantly hard at work to strengthen the security of their software, it makes a lot of sense to optimize it further for added security. Similarly,\u00a0WordPress\u00a0ships with a few features that are rather unnecessary.<\/p>\n

The following coding snippets in the functions.php file of your theme will help you experience better WordPress.<\/p>\n

Remove Meta Tags from WordPress Header<\/h2>\n

Hackers always look for WordPress blogs and sites that are running on older software or less secure versions. It\u2019s easy for them to look at the HTML source code of your website and find which version of WordPress your website is running on. The default WordPress installation carries the following meta tags in its header, which tells the hacker if your website is running on an older version of WordPress software.<\/p>\n

<meta name=”generator” content=”WordPress 4.1″ \/><\/p><\/blockquote>\n

Add the following lines of code to your functions.php file of theme folder and remove the meta tags from WordPress header.<\/p>\n

remove_action( ‘wp_head’, ‘wp_generator’ ) ;
\nremove_action( ‘wp_head’, ‘wlwmanifest_link’ ) ;
\nremove_action( ‘wp_head’, ‘rsd_link’ ) ;<\/p><\/blockquote>\n

Disable HTML in WordPress Comments<\/h2>\n

The default WordPress installation allows visitors to use HTML tags in the comment section. Even though these comments have rel=nofollow attribute enabled on default, it\u2019s still safe to completely disallow HTML in the comment box. Use the following code to your functions.php in order to disallow HTML tags in the comment box .<\/p>\n

add_filter( ‘pre_comment_content’, ‘esc_html’ );<\/p><\/blockquote>\n

Remove Excessive RSS Feeds<\/h2>\n

The WordPress installation generate multiples RSS feeds including blog feed, article feeds, comments feed, category feeds, archive feeds.\u00a0Since these feeds are included in the HTML header of your blog pages, they are auto-discoverable.<\/p>\n

If you want to remove other feeds from and keep your main RSS feed, add the following code to your functions.php file.<\/p>\n

remove_action( ‘wp_head’, ‘feed_links’, 2 );
\nremove_action( ‘wp_head’, ‘feed_links_extra’, 3 );<\/p><\/blockquote>\n

Prevent WordPress from Guessing URLs<\/h2>\n

WordPress tends to guess URLs and does a shoddy job at that. For example, if someone types topleaguetech.com\/hello and it\u2019s not found, WordPress will redirect the user to topleaguetech.com\/hello-world simply because the URLs have similar words in common even though they are contextually irrelevant.<\/p>\n

Ideally, you want WordPress to throw a 404 Not Found error if a particular request is unavailable within your blog.<\/p>\n

Use the following code on your functions.php file to enable WordPress to throw 404 Not Found errors whenever a requested URL is unavailable.<\/p>\n

add_filter(‘redirect_canonical’, ‘stop_guessing’);
\nfunction stop_guessing($url) {
\nif (is_404()) {
\nreturn false;
\n}
\nreturn $url;
\n}<\/p><\/blockquote>\n

Get Rid of Admin Bar<\/h2>\n

Admin Bar is one of the default features on WordPress and it can be pretty annoying for some users when they are logged in to their WordPress.com account.<\/p>\n

To remove the admin bar, add the following code to your functions.php file.<\/p>\n

add_filter(‘show_admin_bar’, ‘__return_false’);<\/p><\/blockquote>\n

Add Brand Logo to RSS Feed<\/h2>\n

If you want to add a little branding to your RSS Feed by inserting an image logo to your articles, use the following snippet to your functions.php file.<\/p>\n

function add_rss_logo($content) {
\nif(is_feed()) {
\n$content .= “<hr><a href=’blog_url’><img src=’logo_url’\/><\/a>”;
\n}
\nreturn $content;
\n}
\nadd_filter(‘the_content’, ‘add_rss_logo’);
\nadd_filter(‘the_excerpt_rss’, ‘add_rss_logo’);<\/p><\/blockquote>\n

Chuck out WordPress Emojis<\/h2>\n

WordPress has recently added Emoji feature to enable users to use Emojis easily. If you don\u2019t want to use emjois or emoctions, you might as well get rid of the additional files by using the following code in your functions.php file.<\/p>\n

remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 );
\nremove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ );<\/p><\/blockquote>\n

<\/h2>\n","protected":false},"excerpt":{"rendered":"

According to Forbes, a whopping 30,000 websites are hacked on a daily basis thanks to their bad hosting practices. Even as the team at WordPress is constantly hard at work to strengthen the security of their software, it makes a lot of sense to optimize it further for added security. If you\u2019re launching a self-hosted WordPress site anytime soon, be sure to check out the following tweaks to make your installation secure.<\/p>\n","protected":false},"author":2,"featured_media":3397,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[6],"tags":[42],"yoast_head":"8 Smart Tweaks for a Better WordPress Blog - Top League<\/title>\n<meta name=\"description\" content=\"The following coding snippets in the functions.php file of your theme will help you experience better WordPress.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"8 Smart Tweaks for a Better WordPress Blog - Top League\" \/>\n<meta property=\"og:description\" content=\"The following coding snippets in the functions.php file of your theme will help you experience better WordPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\" \/>\n<meta property=\"og:site_name\" content=\"Top League\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/topleaguetech\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-23T10:20:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-06-20T15:28:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Susanta Sahoo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@topleaguetech\" \/>\n<meta name=\"twitter:site\" content=\"@topleaguetech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Susanta Sahoo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\"},\"author\":{\"name\":\"Susanta Sahoo\",\"@id\":\"https:\/\/topleaguetech.com\/#\/schema\/person\/91d83a613296f42cd0d9f7d4f8f4ffbf\"},\"headline\":\"8 Smart Tweaks for a Better WordPress Blog\",\"datePublished\":\"2015-07-23T10:20:17+00:00\",\"dateModified\":\"2018-06-20T15:28:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\"},\"wordCount\":675,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/topleaguetech.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg\",\"keywords\":[\"WordPress\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\",\"url\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\",\"name\":\"8 Smart Tweaks for a Better WordPress Blog - Top League\",\"isPartOf\":{\"@id\":\"https:\/\/topleaguetech.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg\",\"datePublished\":\"2015-07-23T10:20:17+00:00\",\"dateModified\":\"2018-06-20T15:28:27+00:00\",\"description\":\"The following coding snippets in the functions.php file of your theme will help you experience better WordPress.\",\"breadcrumb\":{\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage\",\"url\":\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg\",\"contentUrl\":\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg\",\"width\":1024,\"height\":500,\"caption\":\"Wordpress Security\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/topleaguetech.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"8 Smart Tweaks for a Better WordPress Blog\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/topleaguetech.com\/#website\",\"url\":\"https:\/\/topleaguetech.com\/\",\"name\":\"Top League\",\"description\":\"A 360-degree Digital Marketing Agency\",\"publisher\":{\"@id\":\"https:\/\/topleaguetech.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/topleaguetech.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/topleaguetech.com\/#organization\",\"name\":\"Top League Technologies\",\"url\":\"https:\/\/topleaguetech.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/topleaguetech.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2022\/10\/topleaguetech.com_Featured-Image-e1664677009135.png\",\"contentUrl\":\"https:\/\/topleaguetech.com\/wp-content\/uploads\/2022\/10\/topleaguetech.com_Featured-Image-e1664677009135.png\",\"width\":1200,\"height\":630,\"caption\":\"Top League Technologies\"},\"image\":{\"@id\":\"https:\/\/topleaguetech.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/topleaguetech\",\"https:\/\/x.com\/topleaguetech\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/topleaguetech.com\/#\/schema\/person\/91d83a613296f42cd0d9f7d4f8f4ffbf\",\"name\":\"Susanta Sahoo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/topleaguetech.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f363d580b703f602b2169f4beaf96d4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f363d580b703f602b2169f4beaf96d4c?s=96&d=mm&r=g\",\"caption\":\"Susanta Sahoo\"},\"description\":\"I'm the founder and content marketing head at Top League. Our team can help you build great content that helps you rank high on Google and generate high-quality leads. Get in touch with us and let's discuss your project. I'm on LinkedIn & Twitter, just so you know.\",\"sameAs\":[\"susanta@topleaguetech.com\"],\"url\":\"https:\/\/topleaguetech.com\/author\/suskanchan\/\"}]}<\/script>","yoast_head_json":{"title":"8 Smart Tweaks for a Better WordPress Blog - Top League","description":"The following coding snippets in the functions.php file of your theme will help you experience better WordPress.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/","og_locale":"en_US","og_type":"article","og_title":"8 Smart Tweaks for a Better WordPress Blog - Top League","og_description":"The following coding snippets in the functions.php file of your theme will help you experience better WordPress.","og_url":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/","og_site_name":"Top League","article_publisher":"https:\/\/www.facebook.com\/topleaguetech","article_published_time":"2015-07-23T10:20:17+00:00","article_modified_time":"2018-06-20T15:28:27+00:00","og_image":[{"width":1024,"height":500,"url":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg","type":"image\/jpeg"}],"author":"Susanta Sahoo","twitter_card":"summary_large_image","twitter_creator":"@topleaguetech","twitter_site":"@topleaguetech","twitter_misc":{"Written by":"Susanta Sahoo","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#article","isPartOf":{"@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/"},"author":{"name":"Susanta Sahoo","@id":"https:\/\/topleaguetech.com\/#\/schema\/person\/91d83a613296f42cd0d9f7d4f8f4ffbf"},"headline":"8 Smart Tweaks for a Better WordPress Blog","datePublished":"2015-07-23T10:20:17+00:00","dateModified":"2018-06-20T15:28:27+00:00","mainEntityOfPage":{"@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/"},"wordCount":675,"commentCount":1,"publisher":{"@id":"https:\/\/topleaguetech.com\/#organization"},"image":{"@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage"},"thumbnailUrl":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg","keywords":["WordPress"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/topleaguetech.com\/optimize-wordpress-install\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/","url":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/","name":"8 Smart Tweaks for a Better WordPress Blog - Top League","isPartOf":{"@id":"https:\/\/topleaguetech.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage"},"image":{"@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage"},"thumbnailUrl":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg","datePublished":"2015-07-23T10:20:17+00:00","dateModified":"2018-06-20T15:28:27+00:00","description":"The following coding snippets in the functions.php file of your theme will help you experience better WordPress.","breadcrumb":{"@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/topleaguetech.com\/optimize-wordpress-install\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#primaryimage","url":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg","contentUrl":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2015\/07\/wordpress-security1.jpg","width":1024,"height":500,"caption":"Wordpress Security"},{"@type":"BreadcrumbList","@id":"https:\/\/topleaguetech.com\/optimize-wordpress-install\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/topleaguetech.com\/"},{"@type":"ListItem","position":2,"name":"8 Smart Tweaks for a Better WordPress Blog"}]},{"@type":"WebSite","@id":"https:\/\/topleaguetech.com\/#website","url":"https:\/\/topleaguetech.com\/","name":"Top League","description":"A 360-degree Digital Marketing Agency","publisher":{"@id":"https:\/\/topleaguetech.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/topleaguetech.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/topleaguetech.com\/#organization","name":"Top League Technologies","url":"https:\/\/topleaguetech.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/topleaguetech.com\/#\/schema\/logo\/image\/","url":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2022\/10\/topleaguetech.com_Featured-Image-e1664677009135.png","contentUrl":"https:\/\/topleaguetech.com\/wp-content\/uploads\/2022\/10\/topleaguetech.com_Featured-Image-e1664677009135.png","width":1200,"height":630,"caption":"Top League Technologies"},"image":{"@id":"https:\/\/topleaguetech.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/topleaguetech","https:\/\/x.com\/topleaguetech"]},{"@type":"Person","@id":"https:\/\/topleaguetech.com\/#\/schema\/person\/91d83a613296f42cd0d9f7d4f8f4ffbf","name":"Susanta Sahoo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/topleaguetech.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f363d580b703f602b2169f4beaf96d4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f363d580b703f602b2169f4beaf96d4c?s=96&d=mm&r=g","caption":"Susanta Sahoo"},"description":"I'm the founder and content marketing head at Top League. Our team can help you build great content that helps you rank high on Google and generate high-quality leads. Get in touch with us and let's discuss your project. I'm on LinkedIn & Twitter, just so you know.","sameAs":["susanta@topleaguetech.com"],"url":"https:\/\/topleaguetech.com\/author\/suskanchan\/"}]}},"_links":{"self":[{"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/posts\/3092"}],"collection":[{"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/comments?post=3092"}],"version-history":[{"count":0,"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/posts\/3092\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/media\/3397"}],"wp:attachment":[{"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/media?parent=3092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/categories?post=3092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/topleaguetech.com\/wp-json\/wp\/v2\/tags?post=3092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}