Vamos a limpiar un poco el siempre tan lleno de basura wp_head() que trae WordPress por defecto.
La función wp_head() básicamente lo que hace es llamar funciones y scripts de wp y de los plugins que instalamos y los agrega al header. En una instalación normal con un par de plugins nos encontramos con que wp_head() agregó cosas como estas en home:
-
<link rel='stylesheet' id='wp-pagenavi-css' href='http://wordpress-hacks.com/wp-content/plugins/wp-pagenavi/pagenavi-css.css?ver=2.70' type='text/css' media='all' />
-
<script type='text/javascript' src='http://wordpress-hacks.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
-
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://wordpress-hacks.com/xmlrpc.php?rsd" />
-
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://wordpress-hacks.com/wp-includes/wlwmanifest.xml" />
-
<meta name="generator" content="WordPress 3.3.1" />
-
<meta name="description" content="WordPress Hacks, Tips y consejos de WordPress en español"/>
-
<link rel="stylesheet" href="http://wordpress-hacks.com/wp-content/plugins/ig_syntax_hilite/css/syntax_hilite_css.css" type="text/css" media="all" />
-
<script type="text/javascript" src="http://wordpress-hacks.com/wp-content/plugins/ig_syntax_hilite/js/syntax_hilite_js.js"></script>
Y esto en el single:
-
<link rel="alternate" type="application/rss+xml" title="WordPress Hacks » Rediseño por el cumpleaños #2 Comments Feed" href="http://wordpress-hacks.com/rediseno-por-el-cumpleanios-2.php/feed" />
-
<link rel='stylesheet' id='wp-pagenavi-css' href='http://wordpress-hacks.com/wp-content/plugins/wp-pagenavi/pagenavi-css.css?ver=2.70' type='text/css' media='all' />
-
<script type='text/javascript' src='http://wordpress-hacks.com/wp-includes/js/comment-reply.js?ver=20090102'></script>
-
<script type='text/javascript' src='http://wordpress-hacks.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
-
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://wordpress-hacks.com/xmlrpc.php?rsd" />
-
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://wordpress-hacks.com/wp-includes/wlwmanifest.xml" />
-
<link rel='prev' title='Agregar descripciones a categorías masivamente' href='http://wordpress-hacks.com/agregar-descripciones-a-categorias-masivamente.php' />
-
<meta name="generator" content="WordPress 3.3.1" />
-
<link rel='canonical' href='http://wordpress-hacks.com/rediseno-por-el-cumpleanios-2.php' />
-
<link rel='shortlink' href='http://wordpress-hacks.com/?p=698' />
-
<link rel="stylesheet" href="http://wordpress-hacks.com/wp-content/plugins/ig_syntax_hilite/css/syntax_hilite_css.css" type="text/css" media="all" />
-
<script type="text/javascript" src="http://wordpress-hacks.com/wp-content/plugins/ig_syntax_hilite/js/syntax_hilite_js.js"></script>
Particularmente me gusta optimizarlo a mi manera, hay cosas que suelo eliminar según cada sitio.
Pueden eliminar la función que quieran, van al functions.php del theme que usen (si no existe lo crean) y agregan el código.
Para eliminar jQuery:
-
wp_deregister_script('jquery');
Para eliminar el enlace a RSD:
-
remove_action('wp_head', 'rsd_link');
Para eliminar wlwmanifest (lo usa Windows Live Writer):
-
remove_action('wp_head', 'wlwmanifest_link');
Para eliminar link rel='prev' y rel='next' que son el enlace al post anterior y al siguiente:
-
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
Para eliminar el generador de la versión de WordPress:
-
remove_action('wp_head', 'wp_generator');
Para eliminar rel='canonical' -no lo recomiendo-, pero si lo eliminan porque quieren ordenar el código no se olviden de agregarlo a mano después:
-
remove_action('wp_head', 'rel_canonical');
Para eliminar rel='shortlink':
-
remove_action('wp_head', 'wp_shortlink_wp_head');


