1

Is it safe to remove

get_footer();

from the index.php ?

I don't need any footer.

2 Answers 2

3

Its not safe and not recommended. Thats action that read all Javascripts, CSS from other plugins or theme.

Hide your footer with css or theme option.

#footer,footer{display:none!important}
1
0

Yes, it should be safe if you replace it with wp_footer(), which is the function that includes enqueued scripts in the page and other footer actions in the page. (and maybe optionally do_action( 'get_footer', null, array() ); first, in case you have anything that hooks that.)

But IMO the best / clearest thing to do would be to override footer.php in a child theme with a version that was just

<?php wp_footer();

and leave index.php calling get_footer() as usual.

However there's still a risk that any of the theme scripts you have loaded assume the footer element always exists and try to access it. So please check you don't have any script errors afterwards. If you do, you'd either have to fix the script or leave the footer on the page and use the display:none from the other answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.