functions.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. function fht_enqueue_styles() {
  3. wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
  4. }
  5. add_action( 'wp_enqueue_scripts', 'fht_enqueue_styles' );
  6. function fht_fontkit_name(){ ?>
  7. <link rel="stylesheet" href="https://use.typekit.net/sem4mxq.css"> <?php
  8. };
  9. add_action('wp_head', 'fht_fontkit_name');
  10. remove_action('wp_head', 'index_rel_link' );
  11. remove_action('wp_head', 'rel_canonical');
  12. remove_action('wp_head', 'start_post_rel_link', 10);
  13. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);
  14. remove_action('wp_head', 'wp_shortlink_wp_head', 10);
  15. remove_action('wp_head', 'parent_post_rel_link', 10);
  16. remove_action('wp_head', 'rsd_link');
  17. remove_action('wp_head', 'wlwmanifest_link');
  18. remove_action('wp_head', 'wp_generator');
  19. remove_action('wp_head', 'feed_links_extra', 3 );
  20. remove_action('wp_head', 'feed_links', 2 );
  21. remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);
  22. remove_action('wp_head', 'wp_oembed_add_host_js', 10);
  23. remove_action('wp_head', 'rest_output_link_wp_head', 10);
  24. remove_action('template_redirect', 'rest_output_link_header', 11, 0);
  25. function dw_remove_wp_ver_css_js( $src ) {
  26. if ( strpos( $src, 'ver=' ) )
  27. $src = remove_query_arg( 'ver', $src );
  28. return $src;
  29. }
  30. add_filter( 'style_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
  31. add_filter( 'script_loader_src', 'dw_remove_wp_ver_css_js', 9999 );
  32. add_filter( 'xmlrpc_enabled', '__return_false' );
  33. add_filter( 'wp_headers', 'disable_x_pingback' );
  34. function disable_x_pingback( $headers ) {
  35. unset( $headers['X-Pingback'] );
  36. return $headers;
  37. }
  38. function disable_emojis() {
  39. remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
  40. remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
  41. remove_action( 'wp_print_styles', 'print_emoji_styles' );
  42. remove_action( 'admin_print_styles', 'print_emoji_styles' );
  43. remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
  44. remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
  45. remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
  46. add_filter( 'emoji_svg_url', '__return_false' );
  47. }
  48. add_action( 'init', 'disable_emojis' );
  49. function dw_redirect_attachment_page() {
  50. if ( is_attachment() ) {
  51. global $post;
  52. if ( $post && $post->post_parent ) {
  53. wp_redirect( esc_url( get_permalink( $post->post_parent ) ), 301 );
  54. exit;
  55. } else {
  56. wp_redirect( esc_url( home_url( '/' ) ), 301 );
  57. exit;
  58. }
  59. }
  60. }
  61. add_action( 'template_redirect', 'dw_redirect_attachment_page' );