Edit theme wp_head

You can remove some default WP links of the head by using remove_action(). For example:

// Removes the wlwmanifest link
remove_action( 'wp_head', 'wlwmanifest_link' );
// Removes the RSD link
remove_action( 'wp_head', 'rsd_link' );
// Removes the WP shortlink
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
// Removes the canonical links
remove_action( 'wp_head', 'rel_canonical' );
// Removes the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links_extra', 3 ); 
// Removes links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'feed_links', 2 ); 
// Removes the index link
remove_action( 'wp_head', 'index_rel_link' ); 
// Removes the prev link
remove_action( 'wp_head', 'parent_post_rel_link' ); 
// Removes the start link
remove_action( 'wp_head', 'start_post_rel_link' ); 
// Removes the relational links for the posts adjacent to the current post
remove_action( 'wp_head', 'adjacent_posts_rel_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
// Removes the WordPress version i.e. -
remove_action( 'wp_head', 'wp_generator' );

To remove the emoji support (CSS and Javascript):

remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );

You must use them in your functions.php file.

To edit the files enqueued by your theme (zerif) you will need to edit the functions.php file, as well. For example, you will find something like this:

wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'shortcodes', get_template_directory_uri() . '/css/shortcodes.css' );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css' );
wp_enqueue_script( 'jquery' );

If you don’t find it in your functions.php, it’s because some themes divide the functions.php content among several files, normally included into a specific folder with the name inc, include or framework. That’s easy to know: these files must be loaded into your functions.php. For example:

locate_template( 'inc/widgets.php', true, true );
locate_template( 'inc/sidebars.php', true, true );
locate_template( 'inc/breadcrumbs.php', true, true );
locate_template( 'inc/whatever.php', true, true );

Leave a Comment