There is no doubt that WordPress is currently a relatively easy-to-use PHP program, which can be used in personal blogs, enterprise websites and small business websites. Moreover, the official updates of WordPress and the rich themes of third-party plugins make this program more and more diverse. However, with the continuous upgrading of functions, it will also increase the burden and insecurity of the program.
For example, starting from WordPress 4.4, we add rest API functions, which are not needed for general websites. On the contrary, it will drag down the speed of websites, so we try our best to ban these unnecessary functional requirements. We can see similar link characters in the source code.
<link rel=’ https://api.w.org/ ‘ href=’ https://www.wpfans.org/wp-json/ ‘ />
Here, we will record how to solve this problem. First, he needs to remove this link. Second, he needs to disable rest API functions.
Contents of articleshideFirst, non plugin modeSecond, disable JSON API pluginFirst, non plugin mode
/ / shield rest API < br > fromadd_ filter(‘json_ enabled’, ‘__ return_ false’ );
add_ filter(‘json_ jsonp_ enabled’, ‘__ return_ false’ );
add_ filter(‘rest_ enabled’, ‘__ return_ false’);
add_ filter(‘rest_ jsonp_ enabled’, ‘__ return_ false’);
//Remove the WP JSON tag in the header and the link in the HTTP header < br > fileremove_ action(‘wp_ head’, ‘rest_ output_ link_ wp_ head’, 10 );
remove_ action(‘template_ redirect’, ‘rest_ output_ link_ header’, 11 );
Drop the script to the Functions.php File. However, we will find that the link is removed, but you can still see the output character when you open WP Josn. Then old Chiang Kai Shek used a plugin to solve the problem.
Second, disable JSON API plugin
plug in address: https://wordpress.org/plugins/disable-json-api/
After downloading and starting the plugin, the problem of output characters can be completely solved.