मुझे हाल ही में फ़ीड यूआरएल लिंक तत्वों को हटाने की आवश्यकता है और कोर वर्डप्रेस को अनुकूलित करने से बचने की कोशिश में निम्नलिखित समाधान काम करता है।
सुनिश्चित करें कि आपके पास अपनी थीम निर्देशिका में functions.php
फ़ाइल है जिसका उपयोग आप कर रहे हैं। अगर फ़ाइल नहीं बनाते हैं और फ़ाइल को संपादित नहीं करते हैं। निम्नलिखित पंक्तियां आपके wp_head()
फ़ंक्शन से चुनिंदा लाइनों को हटाने में मदद करेंगी:
<?php
remove_action('wp_head', 'feed_links_extra', 3); // Display the links to the extra feeds such as category feeds
remove_action('wp_head', 'feed_links', 2); // Display the links to the general feeds: Post and Comment Feed
remove_action('wp_head', 'rsd_link'); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action('wp_head', 'wlwmanifest_link'); // Display the link to the Windows Live Writer manifest file.
remove_action('wp_head', 'index_rel_link'); // index link
remove_action('wp_head', 'parent_post_rel_link', 10, 0); // prev link
remove_action('wp_head', 'start_post_rel_link', 10, 0); // start link
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); // Display relational links for the posts adjacent to the current post.
remove_action('wp_head', 'wp_generator'); // Display the XHTML generator that is generated on the wp_head hook, WP version
?>
स्रोत
2016-01-12 17:32:43
यह एक बहुत ही साफ समाधान है। लेकिन ध्यान दें कि यदि आप एक स्व-थीम थीम या बाल थीम का उपयोग नहीं करते हैं तो इन परिवर्तनों को अगले थीम अपडेट के साथ ओवरराइट किया जाएगा। इसे रोकने के लिए [बाल थीम] (https://codex.wordpress.org/Child_Themes) बनाएं या इससे एक छोटी प्लगइन बनाएं। –