|
59 | 59 | */ |
60 | 60 | function es_optimizer_init_settings() { |
61 | 61 | // Register settings |
62 | | - register_setting('es_optimizer_settings', 'es_optimizer_options', 'es_optimizer_validate_options'); |
| 62 | + register_setting('es_optimizer_settings', 'es_optimizer_options', array( |
| 63 | + 'sanitize_callback' => 'es_optimizer_validate_options', |
| 64 | + 'default' => es_optimizer_get_default_options() |
| 65 | + )); |
63 | 66 |
|
64 | 67 | // Register default options if they don't exist |
65 | 68 | if (false === get_option('es_optimizer_options')) { |
@@ -545,7 +548,7 @@ function remove_header_items() { |
545 | 548 |
|
546 | 549 | // Remove WP Shortlink URLs |
547 | 550 | if (isset($options['remove_shortlink']) && $options['remove_shortlink']) { |
548 | | - remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); |
| 551 | + remove_action('wp_head', 'wp_shortlink_wp_head', 10); |
549 | 552 | } |
550 | 553 | } |
551 | 554 | add_action('init', 'remove_header_items'); |
@@ -609,12 +612,10 @@ function add_dns_prefetch() { |
609 | 612 | * so we need to construct it ourselves. |
610 | 613 | */ |
611 | 614 | if (function_exists('esc_html')) { |
612 | | - echo esc_html("\n"); |
613 | | - wp_print_link_tag('dns-prefetch', $escapedDomain); |
| 615 | + echo '<link rel="dns-prefetch" href="' . esc_url($escapedDomain) . '">' . "\n"; |
614 | 616 | return; |
615 | 617 | } |
616 | | - echo "\n"; |
617 | | - wp_print_link_tag('dns-prefetch', $escapedDomain); |
| 618 | + echo '<link rel="dns-prefetch" href="' . esc_url($escapedDomain) . '">' . "\n"; |
618 | 619 | } |
619 | 620 | } |
620 | 621 | // Hook after wp_head and before other elements are added |
|
0 commit comments