Is it safe to remove
get_footer();
from the index.php ?
I don't need any footer.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityIts 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}
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.