{"id":102,"date":"2011-05-17T18:00:34","date_gmt":"2011-05-17T18:00:34","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=102"},"modified":"2011-08-11T06:05:08","modified_gmt":"2011-08-11T06:05:08","slug":"hide-the-wordpress-version-you-are-running","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/hide-the-wordpress-version-you-are-running\/","title":{"rendered":"Hide the WordPress version you are running"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25\" data-permalink=\"https:\/\/pixert.com\/blog\/how-to-upgrade-wordpress\/wordpresslogo\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png?fit=498%2C113&amp;ssl=1\" data-orig-size=\"498,113\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"WordPress &#8211; the logo\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png?fit=300%2C68&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png?fit=498%2C113&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=300%2C68\" alt=\"\" title=\"WordPress - the logo\" width=\"300\" height=\"68\" class=\"aligncenter size-medium wp-image-25\" srcset=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png?resize=300%2C68&amp;ssl=1 300w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo.png?w=498&amp;ssl=1 498w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nIf you are running an old WordPress version with known vulnerabilities, it is unwise to display this information to the public. Why not simply hide the WordPress version entirely?<\/p>\n<p>Add the following to functions.php<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">\r\n&lt;?php \r\nfunction pixert_remove_version() { return ''; }\r\nadd_filter('the_generator', 'pixert_remove_version');\r\n?&gt;\r\n<\/pre>\n<p>or<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">\r\n&lt;?php remove_action('wp_head', 'wp_generator'); ?&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you are running an old WordPress version with known vulnerabilities, it is unwise to display this information to the public. Why not simply hide the WordPress version entirely? Add the following to functions.php &lt;?php function pixert_remove_version() { return &#8221;; } add_filter(&#8216;the_generator&#8217;, &#8216;pixert_remove_version&#8217;); ?&gt; or &lt;?php remove_action(&#8216;wp_head&#8217;, &#8216;wp_generator&#8217;); ?&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54,5],"tags":[55,6,7],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-code-snippet","category-wordpress","tag-code-snippet-2","tag-wordpress-2","tag-wp"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-1E","jetpack-related-posts":[{"id":326,"url":"https:\/\/pixert.com\/blog\/wordpress-how-to-hide-custom-fields-meta-key-from-custom-fields-panel\/","url_meta":{"origin":102,"position":0},"title":"WordPress: How to Hide Custom Field Meta Key from Custom Fields panel","author":"Pixel Insert \/ Pixert","date":"October 31, 2013","format":false,"excerpt":"I learned this trick when someone asked about How to Hide Custom Fields Meta Key from Custom Fields panel. This trick useful when you want to hide certain Custom Fields Meta Key and Value from client or authors Add following code to functions.php [php] add_filter('is_protected_meta', 'my_is_protected_meta_filter1', 10, 2); function my_is_protected_meta_filter1($protected,\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/customfields.png?fit=810%2C300&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/customfields.png?fit=810%2C300&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/customfields.png?fit=810%2C300&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/customfields.png?fit=810%2C300&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":230,"url":"https:\/\/pixert.com\/blog\/disable-all-shortcodes-from-post-content\/","url_meta":{"origin":102,"position":1},"title":"WordPress: Disable All Shortcodes from the_content","author":"Pixel Insert \/ Pixert","date":"May 31, 2012","format":false,"excerpt":"The following code snippet will remove ALL shortcodes from the_content Add the following code snippet to the functions.php of your theme [php] function remove_shortcode_from_index($content) { $content = strip_shortcodes($content); return $content; } add_filter('the_content', 'remove_shortcode_from_index'); [\/php] You can disable shortcodes from particular page, e.g Home Page [php] function remove_shortcode_from_index($content) { if (\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":264,"url":"https:\/\/pixert.com\/blog\/php-find-path-to-base-directory\/","url_meta":{"origin":102,"position":2},"title":"PHP : Find Path to Base Directory","author":"Pixel Insert \/ Pixert","date":"October 24, 2012","format":false,"excerpt":"This script output the path to your base directory (aka \"Document Root\"), this code also useful to debug PATH in PHP errors [text]<?php print ($_SERVER['DOCUMENT_ROOT']); ?>[\/text] This script output \u00a0the path to your base directory with current working dir [text]<?php echo getcwd(); ?>[\/text]","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/php.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":208,"url":"https:\/\/pixert.com\/blog\/how-to-add-a-wordpress-shortcode-outside-post-editor-php-template\/","url_meta":{"origin":102,"position":3},"title":"How to add a WordPress shortcode outside of the post editor or  PHP templates","author":"Pixel Insert \/ Pixert","date":"March 13, 2012","format":false,"excerpt":"Shortcodes were introduced back in WordPress 2.5. Shortcodes are for creating macros to be use in a posts. For instance, the following shortcode (in the post\/page content) would add a photo gallery into the page: [ \u00a0gallery \u00a0] If you want to use that shortcode outside of the WordPress post\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":229,"url":"https:\/\/pixert.com\/blog\/php-conditional-statement-to-identify-ipad-or-ipod-or-iphone\/","url_meta":{"origin":102,"position":4},"title":"PHP Conditional statements to identify iPad or iPod or iPhone","author":"Pixel Insert \/ Pixert","date":"June 1, 2012","format":false,"excerpt":"This tutorial will show you how to detect iPad or iPod or iPhone using PHP Devices which request content from your website (usually) pass a user agent string. This contains information such as its name, OS, browser version, and rendering engine. Apple\u2019s gadgets pass the following user agents, although you\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/05\/ipadiphoneipod.jpg?fit=649%2C540&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/05\/ipadiphoneipod.jpg?fit=649%2C540&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/05\/ipadiphoneipod.jpg?fit=649%2C540&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":100,"url":"https:\/\/pixert.com\/blog\/wordpress-automatic-feed-links\/","url_meta":{"origin":102,"position":5},"title":"WordPress: Automatic Feed Links","author":"Pixel Insert \/ Pixert","date":"May 11, 2011","format":false,"excerpt":"WP themes usually have the following code in header.php [php] <link rel=\"alternate\" type=\"application\/rss+xml\" title=\"RSS 2.0\" href=\"<?php bloginfo('rss2_url'); ?>\" \/> <link rel=\"alternate\" type=\"text\/xml\" title=\"RSS .92\" href=\"<?php bloginfo('rss_url'); ?>\" \/> <link rel=\"alternate\" type=\"application\/atom+xml\" title=\"Atom 0.3\" href=\"<?php bloginfo('atom_url'); ?>\" \/ [\/php] Remove above when you are using the following code [php] add_theme_support('automatic-feed-links'); [\/php]\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}