Can you please check this function and tell me why it’s not working
-
Hi,
add_action('after_setup_theme','add_htaccess'); function add_htaccess($insertion) { $insertion = array( '# Enable Vary: Accept-Encoding Start', '<IfModule mod_headers.c>', '<FilesMatch "\.(js|css|xml|gz)$">', 'Header append Vary: Accept-Encoding', '</FilesMatch>', '</IfModule>', ); $htaccess_file = ABSPATH.'.htaccess'; return insert_with_markers($htaccess_file, '# Testing', (array) $insertion); }
I am trying to add support for Vary: Accept-Encoding from whithin my theme’s function.php file.
Please don’t suggest me to use any plugin, because that the only reason why I am trying to implement this from within my theme.
The idea of using insert_with_markers from this StackOverflow discussion:
https://wordpress.stackexchange.com/questions/36233/how-to-add-htaccess-code-through-a-functionCan you please tell me what I have done wrong?
I am completely new to wordpress development.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Can you please check this function and tell me why it’s not working’ is closed to new replies.